CacheItem
in package
implements
CacheItemInterface
PSR-6 cache item class
Tags
Table of Contents
Interfaces
- CacheItemInterface
Properties
- $expirationSeconds : int|null
- The resolved expiration, in seconds from now (null means "use the pool's default")
- $isHit : bool
- Whether the item was a cache hit
- $key : string
- The cache item key
- $value : mixed
- The cache item value
Methods
- __construct() : mixed
- Constructor
- expiresAfter() : static
- Set the expiration time for this cache item, relative to now
- expiresAt() : static
- Set the expiration time for this cache item
- get() : mixed
- Get the cache item value
- getExpirationSeconds() : int|null
- Get the resolved expiration, in seconds from now (null means "use the pool's default")
- getKey() : string
- Get the cache item key
- isHit() : bool
- Determine if the cache item lookup was a hit
- set() : static
- Set the cache item value
Properties
$expirationSeconds
The resolved expiration, in seconds from now (null means "use the pool's default")
protected
int|null
$expirationSeconds
= null
$isHit
Whether the item was a cache hit
protected
bool
$isHit
= false
$key
The cache item key
protected
string
$key
$value
The cache item value
protected
mixed
$value
= null
Methods
__construct()
Constructor
public
__construct(string $key[, mixed $value = null ][, bool $isHit = false ]) : mixed
Instantiate the cache item object
Parameters
- $key : string
- $value : mixed = null
- $isHit : bool = false
expiresAfter()
Set the expiration time for this cache item, relative to now
public
expiresAfter(int|DateInterval|null $time) : static
Parameters
- $time : int|DateInterval|null
Return values
staticexpiresAt()
Set the expiration time for this cache item
public
expiresAt(DateTimeInterface|null $expiration) : static
Parameters
- $expiration : DateTimeInterface|null
Return values
staticget()
Get the cache item value
public
get() : mixed
getExpirationSeconds()
Get the resolved expiration, in seconds from now (null means "use the pool's default")
public
getExpirationSeconds() : int|null
Return values
int|nullgetKey()
Get the cache item key
public
getKey() : string
Return values
stringisHit()
Determine if the cache item lookup was a hit
public
isHit() : bool
Return values
boolset()
Set the cache item value
public
set(mixed $value) : static
Parameters
- $value : mixed