Description
Same issue in php-cache: https://github.com/php-cache/array-adapter/issues/3
Discussion started on: #17408 (comment)
Stale cache
In current form ArrayAdapter is not really safe for applications where cache can not be stale, where stale is defined as the data placed in cache has been updated in the backend, before cache expiry time is reached.
Scenario calls for using cache invalidation instead of relying on expiry, for more on cache invalidation:
- http://foshttpcache.readthedocs.org/en/stable/invalidation-introduction.html
- Note: In the case of HTTP cache, stale data to users might not be considered a critical issue, however inside an application where entities from a database is cached, stale data can have unexpected consequences on how the application behaves
- https://en.wikipedia.org/wiki/Cache_invalidation
By it's nature, unlike a shared cache pool like memcached, in-memory cache like ArrayAdapter with PHP is not aware of changes going on in other php process on other web requests, another php sapi, or another web server in a cluster setup. Meaning ArrayAdapter is unsafe for use with cache invalidation.
Memory use
Current implementation also does not have any limits on cache items, meaning long running processes doing batch operations will run out of php memory.
For possible fixes see: https://github.com/php-cache/array-adapter/issues/3