class CacheItem implements CacheItemInterface (View source)

Class CacheItem

Methods

__construct(string $key, mixed $value = null, DateInterval|int $ttl = null)

Class constructor.

string
getKey()

Get the key associated with this CacheItem.

mixed
get()

Obtain the value of this cache item.

set(mixed $value)

Set the value of the item.

boolean
isHit()

This boolean value tells us if our cache item is currently in the cache or not.

expiresAt(DateTimeInterface $expiration)

Sets the expiration time for this cache item.

expiresAfter(int|DateInterval $time)

Sets the expiration time for this cache item.

getExpiration()

Method to get property Expiration

Details

at line line 67
__construct(string $key, mixed $value = null, DateInterval|int $ttl = null)

Class constructor.

Parameters

string $key The key for the cache item.
mixed $value The value for the cache item.
DateInterval|int $ttl The expire time.

at line line 91
string getKey()

Get the key associated with this CacheItem.

Return Value

string

at line line 103
mixed get()

Obtain the value of this cache item.

Return Value

mixed

at line line 122
CacheItem set(mixed $value)

Set the value of the item.

If the value is set, we are assuming that there was a valid hit on the cache for the given key.

Parameters

mixed $value The value for the cache item.

Return Value

CacheItem

at line line 137
boolean isHit()

This boolean value tells us if our cache item is currently in the cache or not.

Return Value

boolean

at line line 159
CacheItem expiresAt(DateTimeInterface $expiration)

Sets the expiration time for this cache item.

Parameters

DateTimeInterface $expiration 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 Value

CacheItem The called object.

at line line 196
CacheItem expiresAfter(int|DateInterval $time)

Sets the expiration time for this cache item.

Parameters

int|DateInterval $time 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 Value

CacheItem The called object.

at line line 230
DateTimeInterface getExpiration()

Method to get property Expiration

Return Value

DateTimeInterface