CacheItem
in package
implements
CacheItemInterface
Simple cache item (key, value, ttl) that is being used by all the detection methods of Mobile Detect class.
Table of Contents
Interfaces
- CacheItemInterface
- CacheItemInterface defines an interface for interacting with objects inside a cache.
Properties
- $expiresAfter : DateInterval|null
- $expiresAt : DateTimeInterface|null
- $key : string
- $value : bool|null
Methods
- __construct() : mixed
- expiresAfter() : $this
- Sets the relative expiration time for this cache item.
- expiresAt() : $this
- Sets the absolute expiration time for this cache item.
- get() : bool|null
- 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() : $this
- Sets the value represented by this cache item.
Properties
$expiresAfter
public
DateInterval|null
$expiresAfter
= null
$expiresAt
public
DateTimeInterface|null
$expiresAt
= null
$key
protected
string
$key
Unique key for the cache record.
$value
protected
bool|null
$value
= null
Mobile Detect only needs to store booleans (e.g. "isMobile" => true)
Methods
__construct()
public
__construct(mixed $key[, mixed $value = null ]) : mixed
Parameters
- $key : mixed
- $value : mixed = null
expiresAfter()
Sets the relative expiration time for this cache item.
public
expiresAfter(int|DateInterval|null $time) : $this
Parameters
- $time : int|DateInterval|null
Return values
$thisexpiresAt()
Sets the absolute expiration time for this cache item.
public
expiresAt(DateTimeInterface|null $expiration) : $this
Parameters
- $expiration : DateTimeInterface|null
Return values
$thisget()
Retrieves the value of the item from the cache associated with this object's key.
public
get() : bool|null
Return values
bool|nullgetKey()
Returns the key for the current cache item.
public
getKey() : string
Return values
stringisHit()
Confirms if the cache item lookup resulted in a cache hit.
public
isHit() : bool
Return values
boolset()
Sets the value represented by this cache item.
public
set(mixed $value) : $this
Parameters
- $value : mixed