mirror of
https://github.com/danog/Valinor.git
synced 2024-11-27 04:34:48 +01:00
2d70efbfbb
When the application runs in a development environment, the cache implementation should be decorated with `FileWatchingCache` to prevent invalid cache entries states, which can result in the library not behaving as expected (missing property value, callable with outdated signature, …). ```php $cache = new \CuyZ\Valinor\Cache\FileSystemCache('path/to/cache-dir'); if ($isApplicationInDevelopmentEnvironment) { $cache = new \CuyZ\Valinor\Cache\FileWatchingCache($cache); } (new \CuyZ\Valinor\MapperBuilder()) ->withCache($cache) ->mapper() ->map(SomeClass::class, [/* … */]); ``` This behavior now forces to explicitly inject `FileWatchingCache`, when it was done automatically before; but because it shouldn't be used in a production environment, it will increase overall performance. |
||
---|---|---|
.. | ||
Repository/Cache/Compiler |