cache
cache copied to clipboard
Use native expiration
The library does not use native expiration for expired items. Instead it stores expiration time inside data array and checks if item was expired.
As soon as it just returns boolean false for expired objects there is no ability for client to know if there was any stale data or the key was empty. It ends with higher memory (and network for some drivers) consumption.
The way to fix is to pass callable to the library to let it know, how to create fresh data. In single-threaded environment (which is most native for php) it has no value.
I suggest to use only native expiration time and let client implement use of stale objects implementing some queue-based pattern.