ConnectorCacheTrait
Caching support trait for connectors.
Tags
Table of Contents
- $cache : StorageInterface
- Request cache
- getCachedData() : mixed
- Get a request from cache if available
- getCacheKey() : string
- Create a cache key from client's request state
- setCache() : void
- Set the cache storage
- logCacheDebug() : void
- Log a debug message
- logCacheWarning() : void
- Log a warning message
- putCachedData() : void
- Cache response data.
Properties
$cache
Request cache
protected
StorageInterface
$cache
= null
Methods
getCachedData()
Get a request from cache if available
public
getCachedData(string $key) : mixed
Parameters
- $key : string
-
Cache key
Return values
mixed —getCacheKey()
Create a cache key from client's request state
public
getCacheKey(Client $client) : string
Parameters
- $client : Client
-
HTTP Client
Return values
string —setCache()
Set the cache storage
public
setCache(StorageInterface $cache) : void
Parameters
- $cache : StorageInterface
-
Cache
Return values
void —logCacheDebug()
Log a debug message
protected
logCacheDebug(string $msg) : void
Parameters
- $msg : string
-
Message
Return values
void —logCacheWarning()
Log a warning message
protected
logCacheWarning(string $msg) : void
Parameters
- $msg : string
-
Message
Return values
void —putCachedData()
Cache response data.
protected
putCachedData(string $key, mixed $response) : void
Parameters
- $key : string
-
Cache entry key
- $response : mixed
-
Response to be cached