nexylan / PHPAV

PHP CLI Virus/Malware Scanner
MIT License
27 stars 7 forks source link

Cache system #29

Open soullivaneuh opened 7 years ago

soullivaneuh commented 7 years ago

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:

This will allows to increase the speed of the script.

soullivaneuh commented 7 years ago

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 commented 7 years ago

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