Documentation

CacheItem
in package
implements CacheItemInterface

PSR-6 cache item class

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
5.0.0

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
static

expiresAt()

Set the expiration time for this cache item

public expiresAt(DateTimeInterface|null $expiration) : static
Parameters
$expiration : DateTimeInterface|null
Return values
static

get()

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|null

getKey()

Get the cache item key

public getKey() : string
Return values
string

isHit()

Determine if the cache item lookup was a hit

public isHit() : bool
Return values
bool

set()

Set the cache item value

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

        
On this page

Search results