Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache system #29

Open
soullivaneuh opened this issue Jan 4, 2017 · 2 comments
Open

Cache system #29

soullivaneuh opened this issue Jan 4, 2017 · 2 comments

Comments

@soullivaneuh
Copy link
Contributor

soullivaneuh commented Jan 4, 2017

It would be great to have a cache system.

If a file was analysed before and didn't change since this time, we don't have to analyse it.

Also a --no-cache option must be added to get rid of this system.

Question: Where to store the cache? On the project folder (where the phpav command is run)? On a home special directory (e.g.: ~/.phpav/cache)? I think the second option would be better.

Composer and php-cs-fixer cache system would be a good inspiration.

We can store the cache with this way:

  • Key: The md5 of the file to compare with the queued one.
  • Content: A serialization of a class containing analyse information (infected, not infected, why...)

This will allows to increase the speed of the script.

@soullivaneuh
Copy link
Contributor Author

We can also use a cache system like the Symfony cache component.

It provides multiple cache type (filesystem, doctrine etc) and allows configuration.

The problem is PHP 5.5 is required. But this can be solved thanks to #30.

@soullivaneuh
Copy link
Contributor Author

Also we must not forget about the signature of the cache. The cache must be invalidated if the version of phpav is different.

Example: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/925a5cadb005bef14e0c806fc19bf902e4f80f65/src/Cache/Cache.php#L117-L121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant