PHP Trait Rinvex\Repository\Traits\Cacheable

Show file Open project: rinvex/repository

Protected Properties

Property Type Description
$cacheClearEnabled boolean Indicate if the repository cache clear is enabled.
$cacheDriver string The repository cache driver.
$cacheLifetime float | integer The repository cache lifetime.

Public Methods

Method Description
enableCacheClear ( boolean $status = true ) Enable repository cache clear.
forgetCache ( ) Forget the repository cache.
getCacheDriver ( ) : string Get the repository cache driver.
getCacheLifetime ( ) : float | integer Get the repository cache lifetime.
isCacheClearEnabled ( ) : boolean Determine if repository cache clear is enabled.
setCacheDriver ( string $cacheDriver ) Set the repository cache driver.
setCacheLifetime ( float | integer $cacheLifetime ) Set the repository cache lifetime.

Protected Methods

Method Description
cacheCallback ( string $class, string $method, array $args, Closure $closure ) : mixed Cache given callback.
flushCacheKeys ( ) : array Flush cache keys by mimicking cache tags.
generateCacheHash ( $args ) : string Generate unique query hash.
getCacheKeys ( string $file ) : array Get cache keys.
resetCachedRepository ( ) Reset cached repository to it's defaults.
storeCacheKeys ( string $class, string $method, string $hash ) : void Store cache keys by mimicking cache tags.

Method Details

cacheCallback() protected method

Cache given callback.
protected cacheCallback ( string $class, string $method, array $args, Closure $closure ) : mixed
$class string
$method string
$args array
$closure Closure
return mixed

enableCacheClear() public method

Enable repository cache clear.
public enableCacheClear ( boolean $status = true )
$status boolean

flushCacheKeys() protected method

Flush cache keys by mimicking cache tags.
protected flushCacheKeys ( ) : array
return array

forgetCache() public method

Forget the repository cache.
public forgetCache ( )

generateCacheHash() protected method

Generate unique query hash.
protected generateCacheHash ( $args ) : string
$args
return string

getCacheDriver() public method

Get the repository cache driver.
public getCacheDriver ( ) : string
return string

getCacheKeys() protected method

Get cache keys.
protected getCacheKeys ( string $file ) : array
$file string
return array

getCacheLifetime() public method

Get the repository cache lifetime.
public getCacheLifetime ( ) : float | integer
return float | integer

isCacheClearEnabled() public method

Determine if repository cache clear is enabled.
public isCacheClearEnabled ( ) : boolean
return boolean

resetCachedRepository() protected method

Reset cached repository to it's defaults.
protected resetCachedRepository ( )

setCacheDriver() public method

Set the repository cache driver.
public setCacheDriver ( string $cacheDriver )
$cacheDriver string

setCacheLifetime() public method

Set the repository cache lifetime.
public setCacheLifetime ( float | integer $cacheLifetime )
$cacheLifetime float | integer

storeCacheKeys() protected method

Store cache keys by mimicking cache tags.
protected storeCacheKeys ( string $class, string $method, string $hash ) : void
$class string
$method string
$hash string
return void

Property Details

$cacheClearEnabled protected property

Indicate if the repository cache clear is enabled.
protected bool $cacheClearEnabled
return boolean

$cacheDriver protected property

The repository cache driver.
protected string $cacheDriver
return string

$cacheLifetime protected property

The repository cache lifetime.
protected float|int $cacheLifetime
return float | integer