PHP Class Jarves\Cache\Backend\AbstractCache

Inheritance: implements Jarves\Cache\Backend\CacheInterface
显示文件 Open project: jarves/jarves Class Usage Examples

Public Properties

Property Type Description
$cache array All gets/sets will be cached in this array for faster access during multiple get() calls on the same key.
$instance Contains the current class instance.

Protected Properties

Property Type Description
$cacheConfig Jarves\Configuration\Cache
$config array All config values as array.
$eventDispatcher

Public Methods

Method Description
__construct ( ) Constructor.
configure ( Cache $cacheConfig )
delete ( string $key ) : boolean Deletes the cache for specified cache-key.
deleteInvalidate ( string $key ) Removes a invalidation
get ( string $key ) : mixed Returns data of the specified cache-key.
getEventDispatcher ( ) : mixed
getInvalidate ( string $key ) : integer | null Returns latest invalidation timestamp for the given $key.
invalidate ( string $key, boolean | integer $time = null ) : boolean Marks a code as invalidate until $time.
set ( string $key, mixed $value, integer $lifeTime = 3600, boolean $withoutValidationData = false ) : boolean Stores data to the specified cache-key.
setEventDispatcher ( mixed $eventDispatcher )
setup ( $config ) Connects to Server, prepared Folder structure, etc.
testConfig ( array $config ) : boolean Test the cache driver whether the config values are correct and useable or not.

Protected Methods

Method Description
doDelete ( string $pKey ) Deletes data for a key.
doGet ( string $pKey ) : mixed | false Gets the data for a key.
doSet ( string $pKey, mixed $pValue, integer $pTimeout = null ) : boolean Sets data for a key with a timeout.

Method Details

__construct() public method

Constructor.
public __construct ( )

configure() public method

public configure ( Cache $cacheConfig )
$cacheConfig Jarves\Configuration\Cache

delete() public method

Deletes the cache for specified cache-key.
public delete ( string $key ) : boolean
$key string
return boolean

deleteInvalidate() public method

Removes a invalidation
public deleteInvalidate ( string $key )
$key string

doDelete() abstract protected method

Deletes data for a key.
abstract protected doDelete ( string $pKey )
$pKey string

doGet() abstract protected method

Gets the data for a key.
abstract protected doGet ( string $pKey ) : mixed | false
$pKey string
return mixed | false return false when cache does not exist

doSet() abstract protected method

Sets data for a key with a timeout.
abstract protected doSet ( string $pKey, mixed $pValue, integer $pTimeout = null ) : boolean
$pKey string
$pValue mixed
$pTimeout integer
return boolean

get() public method

Returns data of the specified cache-key.
public get ( string $key ) : mixed
$key string
return mixed

getEventDispatcher() public method

public getEventDispatcher ( ) : mixed
return mixed

getInvalidate() public method

Returns an timestamp as integer which tells the cache handler that all stored caches before this timestamp are automatically invalidated.
public getInvalidate ( string $key ) : integer | null
$key string
return integer | null

invalidate() public method

Marks a code as invalidate until $time.
public invalidate ( string $key, boolean | integer $time = null ) : boolean
$key string
$time boolean | integer
return boolean

set() public method

If you want to save php class objects, you should serialize it before.
public set ( string $key, mixed $value, integer $lifeTime = 3600, boolean $withoutValidationData = false ) : boolean
$key string
$value mixed Do not pass objects, use serialize if you want to store php objects
$lifeTime integer In seconds. Default is one hour
$withoutValidationData boolean
return boolean

setEventDispatcher() public method

public setEventDispatcher ( mixed $eventDispatcher )
$eventDispatcher mixed

setup() public method

Connects to Server, prepared Folder structure, etc.
public setup ( $config )

testConfig() public method

This should also check whether the driver can be used in general or not (like if a necessary php module is loaded or not).
public testConfig ( array $config ) : boolean
$config array
return boolean returns true if everything is fine, if not it should throw an exception with the detailed issue.

Property Details

$cache public_oe property

All gets/sets will be cached in this array for faster access during multiple get() calls on the same key.
public array $cache
return array

$cacheConfig protected_oe property

protected Cache,Jarves\Configuration $cacheConfig
return Jarves\Configuration\Cache

$config protected_oe property

All config values as array.
protected array $config
return array

$eventDispatcher protected_oe property

protected $eventDispatcher

$instance public_oe property

Contains the current class instance.
public $instance