Methods summary
public static
MvcCore\Ext\Cache
|
#
GetInstance( )
Create or get cached redis cache wrapper instance.
Create or get cached redis cache wrapper instance.
Returns
|
public
boolean
|
#
Connect( )
Connect to redis server by configuration given in constructor.
Return boolean about connection success (not about cache enabled or disabled).
Connect to redis server by configuration given in constructor.
Return boolean about connection success (not about cache enabled or disabled).
Returns
boolean
|
public
resource|object|null
|
#
GetResource( )
Get resource instance.
Returns
resource|object|null
|
public
MvcCore\Ext\Cache
|
#
SetResource( resource|object $resource )
Set resource instance.
Parameters
Returns
|
public
stdClass
|
#
GetConfig( )
Return initial configuration data.
Return initial configuration data.
Returns
stdClass
|
public
MvcCore\Ext\Cache
|
#
SetEnabled( boolean $enabled )
Enable/disable cache component.
Enable/disable cache component.
Parameters
Returns
|
public
boolean
|
#
GetEnabled( )
Get if cache component is enabled/disabled.
Get if cache component is enabled/disabled.
Returns
boolean
|
public
array
|
#
ProcessTransaction( array $ops = [] )
Process given operations in transaction mode.
Process given operations in transaction mode.
Parameters
- $ops
- Keys are client functions names, values are functions arguments.
Returns
array
|
public
boolean
|
#
Save( string $key, mixed $content, integer $expirationSeconds = NULL, array $cacheTags = [] )
Set content under key with seconds expiration and tag(s).
Set content under key with seconds expiration and tag(s).
Parameters
- $key
- $content
- $expirationSeconds
- $cacheTags
Returns
boolean
|
public
boolean
|
#
SaveMultiple( array $keysAndContents, integer $expirationSeconds = NULL, array $cacheTags = [] )
Set multiple contents under keys with seconds expirations and tags.
Set multiple contents under keys with seconds expirations and tags.
Parameters
- $keysAndContents
- $expirationSeconds
- $cacheTags
Returns
boolean
|
public
mixed|null
|
#
Load( string $key, callable $notFoundCallback = NULL )
Return mixed content from cache by key or return NULL if content doens't
exist in cache for given key.
Return mixed content from cache by key or return NULL if content doens't
exist in cache for given key.
Parameters
- $key
- $notFoundCallback
- function ($cache, $cacheKey) { ... $cache->Save($cacheKey, $data); return $data; }
Returns
mixed|null
|
public
mixed|null
|
#
LoadMultiple( array $keys, callable $notFoundCallback = NULL )
Get content by key.
Parameters
- $keys
- $notFoundCallback
- function ($cache, $cacheKey) { ... $cache->Save($cacheKey, $data); return $data; }
Returns
mixed|null
|
public
boolean
|
#
Delete( string $key )
Delete cache record by key.
Delete cache record by key.
Parameters
Returns
boolean
|
public
integer
|
#
DeleteMultiple( array $keys, array $keysTags = [] )
Delete cache record(s) by key(s).
Delete cache record(s) by key(s).
Parameters
Returns
integer
|
public
integer
|
#
DeleteByTags( string|array $tags )
Delete cache record by key.
Delete cache record by key.
Parameters
Returns
integer
|
public
integer
|
#
Has( string $key )
Return 1 if cache has any record under given key, 0 if not.
Return 1 if cache has any record under given key, 0 if not.
Parameters
Returns
integer
|
public
integer
|
#
HasMultiple( string $keys )
Return 1 if cache has any record under given key, 0 if not.
Return 1 if cache has any record under given key, 0 if not.
Parameters
Returns
integer
|
public
boolean
|
#
Clear( )
Remove everything from used cache database.
Remove everything from used cache database.
Returns
boolean
|