Documentation

CacheItem
in package
implements ItemInterface

FinalYes
Tags
author

Nicolas Grekas p@tchwork.com

Table of Contents

Interfaces

ItemInterface
Augments PSR-6's CacheItemInterface with support for tags and metadata.

Constants

METADATA_EXPIRY_OFFSET  = 1527506807

Properties

$expiry  : float|int|null
$innerItem  : mixed
$isHit  : bool
$isTaggable  : bool
$key  : string
$metadata  : array<string|int, mixed>
$newMetadata  : array<string|int, mixed>
$poolHash  : string|null
$value  : mixed

Methods

expiresAfter()  : $this
{@inheritdoc}
expiresAt()  : $this
{@inheritdoc}
get()  : mixed
{@inheritdoc}
getKey()  : string
{@inheritdoc}
getMetadata()  : array<string|int, mixed>
Returns a list of metadata info that were saved alongside with the cached value.
isHit()  : bool
{@inheritdoc}
set()  : $this
{@inheritdoc}
tag()  : $this
Adds a tag to a cache item.
validateKey()  : string
Validates a cache key according to PSR-6.

Constants

METADATA_EXPIRY_OFFSET

private mixed METADATA_EXPIRY_OFFSET = 1527506807

Properties

$expiry

protected float|int|null $expiry = null

$innerItem

protected mixed $innerItem = null

$isTaggable

protected bool $isTaggable = false

$metadata

protected array<string|int, mixed> $metadata = []

$newMetadata

protected array<string|int, mixed> $newMetadata = []

$poolHash

protected string|null $poolHash = null

Methods

expiresAfter()

{@inheritdoc}

public expiresAfter(mixed $time) : $this
Parameters
$time : mixed
Return values
$this

expiresAt()

{@inheritdoc}

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

getKey()

{@inheritdoc}

public getKey() : string
Return values
string

getMetadata()

Returns a list of metadata info that were saved alongside with the cached value.

public getMetadata() : array<string|int, mixed>
Return values
array<string|int, mixed>

isHit()

{@inheritdoc}

public isHit() : bool
Return values
bool

set()

{@inheritdoc}

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

tag()

Adds a tag to a cache item.

public tag(mixed $tags) : $this
Parameters
$tags : mixed

A tag or array of tags

Return values
$this

validateKey()

Validates a cache key according to PSR-6.

public static validateKey(mixed $key) : string
Parameters
$key : mixed

The key to validate

Tags
throws
InvalidArgumentException

When $key is not valid

Return values
string

        
On this page

Search results