CacheItem
in package
implements
CacheItemInterface
This class represents a cache item that implements the PSR-16 CacheItemInterface.
Tags
Interfaces, Classes and Traits
- CacheItemInterface
- CacheItemInterface defines an interface for interacting with objects inside a cache.
Table of Contents
- $hit : bool
- $key : string
- Cache Key
- $value : mixed
- Cache value
- __construct() : mixed
- Class constructor
- expiresAfter() : static
- Set the expiration time of the cache item (in seconds)
- expiresAt() : static
- Set the expiration date and time of the cache item
- get() : mixed
- Get the value of the cache item
- getKey() : string
- Get the key of the cache item
- isHit() : bool
- Check if the cache item has a value
- set() : static
- Set the value of the cache item
Properties
$hit
private
bool
$hit
$key
Cache Key
private
string
$key
$value
Cache value
private
mixed
$value
Methods
__construct()
Class constructor
public
__construct(string $key) : mixed
Parameters
- $key : string
-
Cache Key
Return values
mixed —expiresAfter()
Set the expiration time of the cache item (in seconds)
public
expiresAfter(int|DateInterval $time) : static
Parameters
- $time : int|DateInterval
Return values
static —expiresAt()
Set the expiration date and time of the cache item
public
expiresAt(DateTimeInterface $expiration) : static
Parameters
- $expiration : DateTimeInterface
Return values
static —get()
Get the value of the cache item
public
get() : mixed
Return values
mixed —getKey()
Get the key of the cache item
public
getKey() : string
Return values
string —isHit()
Check if the cache item has a value
public
isHit() : bool
Return values
bool —set()
Set the value of the cache item
public
set(mixed $value) : static
Parameters
- $value : mixed