Documentation

CacheItem
in package
implements CacheItemInterface

FinalYes

Table of Contents

Interfaces

CacheItemInterface
CacheItemInterface defines an interface for interacting with objects inside a cache.

Properties

$expiry  : float|null
$isHit  : bool
$key  : string
$value  : mixed

Methods

expiresAfter()  : static
Sets the expiration time for this cache item.
expiresAt()  : static
Sets the expiration time for this cache item.
get()  : mixed
Retrieves the value of the item from the cache associated with this object's key.
getKey()  : string
Returns the key for the current cache item.
isHit()  : bool
Confirms if the cache item lookup resulted in a cache hit.
set()  : static
Sets the value represented by this cache item.

Properties

Methods

expiresAfter()

Sets the expiration time for this cache item.

public expiresAfter(mixed $time) : static
Parameters
$time : mixed

The period of time from the present after which the item MUST be considered expired. An integer parameter is understood to be the time in seconds until expiration. If null is passed explicitly, a default value MAY be used. If none is set, the value should be stored permanently or for as long as the implementation allows.

Return values
static

The called object.

expiresAt()

Sets the expiration time for this cache item.

public expiresAt(mixed $expiration) : static
Parameters
$expiration : mixed

The point in time after which the item MUST be considered expired. If null is passed explicitly, a default value MAY be used. If none is set, the value should be stored permanently or for as long as the implementation allows.

Return values
static

The called object.

get()

Retrieves the value of the item from the cache associated with this object's key.

public get() : mixed

getKey()

Returns the key for the current cache item.

public getKey() : string

The key is loaded by the Implementing Library, but should be available to the higher level callers when needed.

Return values
string

The key string for this cache item.

isHit()

Confirms if the cache item lookup resulted in a cache hit.

public isHit() : bool

Note: This method MUST NOT have a race condition between calling isHit() and calling get().

Return values
bool

True if the request resulted in a cache hit. False otherwise.

set()

Sets the value represented by this cache item.

public set(mixed $value) : static
Parameters
$value : mixed

The serializable value to be stored.

Return values
static

The invoked object.


        
On this page

Search results