cache invalidation - phpgt/FileCache GitHub Wiki
FileCache provides explicit methods to invalidate cached entries when they are no longer valid.
Remove a specific cache entry by calling the invalidate
method:
$cache->invalidate("user-profile");
Check whether a cache's key is valid with the checkValidity
method:
if($cache->checkValidity("user-profile")) {
// do something ...
}
When constructing the Cache
class, the $secondsValid
parameter is used to indicate how long a cache is valid for. The default value is 1 hour. After the time expires, the cache will become invalid, so the next time the cache is read, the callback function will be executed to refresh the cache.