PHP Class Stash\Pool

Author: Robert Hafner ([email protected])
Inheritance: implements Stash\Interfaces\PoolInterface
Mostrar archivo Open project: tedivm/stash Class Usage Examples

Protected Properties

Property Type Description
$driver Stash\Interfaces\DriverInterface The cacheDriver being used by the system. While this class handles all of the higher functions, it's the cache driver here that handles all of the storage/retrieval functionality. This value is set by the constructor.
$isDisabled boolean Is this Pool disabled.
$itemClass string Default "Item" class to use for making new items.
$logger Psr\Log\LoggerInterface If set various then errors and exceptions will get passed to the PSR Compliant logging library. This can be set using the setLogger() function in this class.
$namespace string Current namespace, if any.

Public Methods

Method Description
__construct ( Stash\Interfaces\DriverInterface $driver = null ) The constructor takes a Driver class which is used for persistent storage. If no driver is provided then the Ephemeral driver is used by default.
clear ( )
commit ( )
deleteItem ( $key )
deleteItems ( array $keys )
getDriver ( )
getItem ( $key )
getItems ( array $keys = [] )
getNamespace ( )
hasItem ( $key )
purge ( )
save ( Psr\Cache\CacheItemInterface $item )
saveDeferred ( Psr\Cache\CacheItemInterface $item )
setDriver ( Stash\Interfaces\DriverInterface $driver )
setItemClass ( $class )
setLogger ( $logger )
setNamespace ( $namespace = null )

Protected Methods

Method Description
logException ( string $message, Exception $exception ) : boolean Logs an exception with the Logger class, if it exists.

Method Details

__construct() public method

The constructor takes a Driver class which is used for persistent storage. If no driver is provided then the Ephemeral driver is used by default.
public __construct ( Stash\Interfaces\DriverInterface $driver = null )
$driver Stash\Interfaces\DriverInterface

clear() public method

public clear ( )

commit() public method

public commit ( )

deleteItem() public method

public deleteItem ( $key )

deleteItems() public method

public deleteItems ( array $keys )
$keys array

getDriver() public method

public getDriver ( )

getItem() public method

public getItem ( $key )

getItems() public method

public getItems ( array $keys = [] )
$keys array

getNamespace() public method

public getNamespace ( )

hasItem() public method

public hasItem ( $key )

logException() protected method

Logs an exception with the Logger class, if it exists.
protected logException ( string $message, Exception $exception ) : boolean
$message string
$exception Exception
return boolean

purge() public method

public purge ( )

save() public method

public save ( Psr\Cache\CacheItemInterface $item )
$item Psr\Cache\CacheItemInterface

saveDeferred() public method

public saveDeferred ( Psr\Cache\CacheItemInterface $item )
$item Psr\Cache\CacheItemInterface

setDriver() public method

public setDriver ( Stash\Interfaces\DriverInterface $driver )
$driver Stash\Interfaces\DriverInterface

setItemClass() public method

public setItemClass ( $class )

setLogger() public method

public setLogger ( $logger )

setNamespace() public method

public setNamespace ( $namespace = null )

Property Details

$driver protected_oe property

The cacheDriver being used by the system. While this class handles all of the higher functions, it's the cache driver here that handles all of the storage/retrieval functionality. This value is set by the constructor.
protected DriverInterface,Stash\Interfaces $driver
return Stash\Interfaces\DriverInterface

$isDisabled protected_oe property

Is this Pool disabled.
protected bool $isDisabled
return boolean

$itemClass protected_oe property

Default "Item" class to use for making new items.
protected string $itemClass
return string

$logger protected_oe property

If set various then errors and exceptions will get passed to the PSR Compliant logging library. This can be set using the setLogger() function in this class.
protected Psr\Log\LoggerInterface $logger
return Psr\Log\LoggerInterface

$namespace protected_oe property

Current namespace, if any.
protected string $namespace
return string