PHP 클래스 lithium\storage\cache\Adapter

Each adapter provides a consistent interface for the basic cache operations of write, read, delete, increment and decrement which can always be _used interchangeably_ between and must be implemented by all adapters. Functionality for clear, clean may or may not be implemented by an adapter. Calling a method that is not implemented will simply return false. An adapter may provide access to additional methods. It's always possible to call them directly. This allows a very wide range of flexibility, at the cost of portability. Cache::adapter('default')->methodName($argument); It is not guaranteed that all operations are atomic, but adapters will try to perform atomic operations wherever possible. If you rely on atomicity of operations you must choose an appropriate adapter that explitcly supports these. Adapters may handle serialization and/or multi-keys natively others only synthetically.
상속: extends lithium\core\Object
파일 보기 프로젝트 열기: unionofrad/lithium 1 사용 예제들

공개 메소드들

메소드 설명
clean ( ) : boolean Perform garbage collection.
clear ( ) : boolean Clears entire cache by flushing it. All cache keys using the configuration but *without* honoring the scope are removed.
decrement ( string $key, integer $offset = 1 ) : integer | boolean Performs a decrement operation on specified numeric cache item.
delete ( array $keys ) : boolean Will attempt to remove specified keys from the user space cache.
enabled ( ) : boolean Determines if an adapter is available for usage and all preconditions are met (i.e. extension installed).
increment ( string $key, integer $offset = 1 ) : integer | boolean Performs an increment operation on specified numeric cache item.
read ( array $keys ) : array Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.
write ( array $keys, string | integer $expiry = null ) : boolean Write values to the cache. All items to be cached will receive an expiration time of $expiry.

보호된 메소드들

메소드 설명
_addScopePrefix ( string $scope, array $keys, string $separator = ':' ) : array Adds scope prefix to keys using separator.
_removeScopePrefix ( string $scope, array $data, string $separator = ':' ) : array Removes scope prefix from keys.

메소드 상세

_addScopePrefix() 보호된 메소드

Adds scope prefix to keys using separator.
protected _addScopePrefix ( string $scope, array $keys, string $separator = ':' ) : array
$scope string Scope to use when prefixing.
$keys array Array of keys either with or without mapping to values.
$separator string String to use when separating scope from key.
리턴 array Prefixed keys array.

_removeScopePrefix() 보호된 메소드

Removes scope prefix from keys.
protected _removeScopePrefix ( string $scope, array $data, string $separator = ':' ) : array
$scope string Scope initially used when prefixing.
$data array
$separator string Separator used when prefix keys initially.
리턴 array Keys array with prefix removed from each key.

clean() 공개 메소드

Perform garbage collection.
public clean ( ) : boolean
리턴 boolean `true` on successful clean, `false` otherwise.

clear() 공개 메소드

Clears entire cache by flushing it. All cache keys using the configuration but *without* honoring the scope are removed.
public clear ( ) : boolean
리턴 boolean `true` on successful clearing, `false` if failed partially or entirely.

decrement() 추상적인 공개 메소드

Performs a decrement operation on specified numeric cache item.
abstract public decrement ( string $key, integer $offset = 1 ) : integer | boolean
$key string Key of numeric cache item to decrement.
$offset integer Offset to decrement - defaults to `1`.
리턴 integer | boolean The item's new value on successful decrement, else `false`.

delete() 추상적인 공개 메소드

Will attempt to remove specified keys from the user space cache.
abstract public delete ( array $keys ) : boolean
$keys array Keys to uniquely identify the cached items.
리턴 boolean `true` on successful delete, `false` otherwise.

enabled() 공개 정적인 메소드

Override to check for preconditions.
public static enabled ( ) : boolean
리턴 boolean `true` if enabled, `false` otherwise.

increment() 추상적인 공개 메소드

Performs an increment operation on specified numeric cache item.
abstract public increment ( string $key, integer $offset = 1 ) : integer | boolean
$key string Key of numeric cache item to increment.
$offset integer Offset to increment - defaults to `1`.
리턴 integer | boolean The item's new value on successful increment, else `false`.

read() 추상적인 공개 메소드

Read values from the cache. Will attempt to return an array of data containing key/value pairs of the requested data.
abstract public read ( array $keys ) : array
$keys array Keys to uniquely identify the cached items.
리턴 array Cached values keyed by cache keys on successful read, keys which could not be read will not be included in the results array.

write() 추상적인 공개 메소드

Write values to the cache. All items to be cached will receive an expiration time of $expiry.
abstract public write ( array $keys, string | integer $expiry = null ) : boolean
$keys array Key/value pairs with keys to uniquely identify the to-be-cached item.
$expiry string | integer A `strtotime()` compatible cache time or TTL in seconds. To persist an item use `\lithium\storage\Cache::PERSIST`.
리턴 boolean `true` on successful write, `false` otherwise.