-
-
Notifications
You must be signed in to change notification settings - Fork 1
Cache invalidation
Greg Bowler edited this page Jun 10, 2025
·
1 revision
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.
PHP.GT/FileCache is a separately maintained component of PHP.GT/WebEngine.