CacheHandlerInterface
in
Table of Contents
- allowCache() : bool
- Get last validate process result.
- clearCache() : bool
- Clear all available caches.
- deleteCache() : bool
- Delete individual cache based $key parameter.
- getContent() : string|null
- Get cache content from storage cache.
- getExpireTime() : int|null
- Get cache expire time from cache storage.
- getTtl() : int
- Get cache TTL from storage.
- hasCache() : bool
- Check request already has cache or not.
- setContent() : bool
- Set cache content to storage cache.
- setIP() : self
- Set IP property for class.
- setKey() : self
- Set key property for class, use for cache key.
- setPath() : self
- Set path property for class.
- validate() : bool
- Validate request is allowed to cache or not, based class properties and 'mezzio_response_cache' configurations.
Methods
allowCache()
Get last validate process result.
public
allowCache() : bool
Return values
bool —Validate process result.
clearCache()
Clear all available caches.
public
clearCache() : bool
Return values
bool —Clear process result.
deleteCache()
Delete individual cache based $key parameter.
public
deleteCache(string $key) : bool
Parameters
- $key : string
-
Cache key to delete.
Return values
bool —Delete process result.
getContent()
Get cache content from storage cache.
public
getContent([string|null $key = null ]) : string|null
Parameters
- $key : string|null = null
-
String cache key.
Return values
string|null —String Cache content or null.
getExpireTime()
Get cache expire time from cache storage.
public
getExpireTime([string|null $key = null ]) : int|null
Parameters
- $key : string|null = null
-
String cache key.
Return values
int|null —Second expire time.
getTtl()
Get cache TTL from storage.
public
getTtl() : int
Return values
int —Second TTL.
hasCache()
Check request already has cache or not.
public
hasCache([string|null $key = null ]) : bool
If parameter $key is null, then use already existing key.
Parameters
- $key : string|null = null
-
String cache key.
Return values
bool —Check result.
setContent()
Set cache content to storage cache.
public
setContent(mixed $content[, string|null $key = null ][, int|null $duration = null ]) : bool
Parameters
- $content : mixed
-
Content to cache.
- $key : string|null = null
-
String cache key.
- $duration : int|null = null
-
Second duration cache.
Return values
bool —Set cache result.
setIP()
Set IP property for class.
public
setIP(string $ip) : self
Parameters
- $ip : string
-
String request IP address.
Return values
self —Class instance.
setKey()
Set key property for class, use for cache key.
public
setKey(string|null $key) : self
If null then use request URI path value for key.
Parameters
- $key : string|null
-
String key for cache.
Return values
self —Class instance.
setPath()
Set path property for class.
public
setPath(string $path) : self
Parameters
- $path : string
-
String request URI path.
Return values
self —Class instance.
validate()
Validate request is allowed to cache or not, based class properties and 'mezzio_response_cache' configurations.
public
validate() : bool
Return values
bool —Validation result.