PHP Class Newscoop\Services\CacheService

Show file Open project: sourcefabric/newscoop Class Usage Examples

Protected Properties

Property Type Description
$cacheDriver Doctrine\Common\Cache\CacheProvider Instance of cache driver
$systemPreferences Newscoop\NewscoopBundle\Services\SystemPreferencesService

Public Methods

Method Description
__construct ( SystemPreferencesService $systemPreferences ) Initialize cache driver (based on system preferences settings, default is array)
clearNamespace ( $namespace )
contains ( string | array $id ) : boolean Check if cache have provided key
delete ( string | array $id ) : boolean Delete key from cache
fetch ( string | array $id ) : mixed Fetch data from cache
getAvailableCacheEngines ( ) : array Get array of avaiable cache drivers (based on system configurations)
getCacheDriver ( ) : CacheProvider Get cache driver instance
getCacheKey ( $id, $namespace = null )
getNamespace ( $namespace )
save ( string | array $id, mixed $data, integer $lifeTime = 1400 ) : boolean Save new value in cache

Method Details

__construct() public method

Initialize cache driver (based on system preferences settings, default is array)
public __construct ( SystemPreferencesService $systemPreferences )
$systemPreferences Newscoop\NewscoopBundle\Services\SystemPreferencesService

clearNamespace() public method

public clearNamespace ( $namespace )

contains() public method

Check if cache have provided key
public contains ( string | array $id ) : boolean
$id string | array
return boolean

delete() public method

Delete key from cache
public delete ( string | array $id ) : boolean
$id string | array
return boolean

fetch() public method

Fetch data from cache
public fetch ( string | array $id ) : mixed
$id string | array
return mixed

getAvailableCacheEngines() public method

Get array of avaiable cache drivers (based on system configurations)
public getAvailableCacheEngines ( ) : array
return array

getCacheDriver() public method

Get cache driver instance
public getCacheDriver ( ) : CacheProvider
return Doctrine\Common\Cache\CacheProvider

getCacheKey() public method

public getCacheKey ( $id, $namespace = null )

getNamespace() public method

public getNamespace ( $namespace )

save() public method

Save new value in cache
public save ( string | array $id, mixed $data, integer $lifeTime = 1400 ) : boolean
$id string | array
$data mixed
$lifeTime integer
return boolean

Property Details

$cacheDriver protected property

Instance of cache driver
protected CacheProvider,Doctrine\Common\Cache $cacheDriver
return Doctrine\Common\Cache\CacheProvider

$systemPreferences protected property

protected SystemPreferencesService,Newscoop\NewscoopBundle\Services $systemPreferences
return Newscoop\NewscoopBundle\Services\SystemPreferencesService