Documentation

NullAdapter extends AbstractAdapter
in package

Null adapter cache 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

Properties

$clock  : ClockInterface
Clock used to resolve the current time
$ttl  : int
Global time-to-live

Methods

__construct()  : mixed
Constructor
clear()  : NullAdapter
Clear all stored values from cache
decrementItem()  : int
Always returns $initial - $amount — nothing is ever actually persisted, so every call behaves as if the counter had just been created and immediately decremented once; there is no "first call" state.
deleteItem()  : NullAdapter
Delete a value in cache
destroy()  : NullAdapter
Destroy cache resource
getItem()  : mixed
Get an item from cache
getItemTtl()  : int
Get the time-to-live for an item in cache
getTtl()  : int
Get the global time-to-live for the cache object
hasItem()  : bool
Determine if the item exist in cache
incrementItem()  : int
Always returns $initial + $amount — nothing is ever actually persisted, so every call behaves as if the counter had just been created and immediately incremented once; there is no "first call" state.
saveItem()  : NullAdapter
Save an item to cache
setTtl()  : AbstractAdapter
Set the global time-to-live for the cache adapter
isFresh()  : bool
Determine if a cache envelope (with 'start'/'ttl' keys) is still within its time-to-live

Properties

Methods

__construct()

Constructor

public __construct([int $ttl = 0 ][, ClockInterface $clock = new ClockSystemClock() ]) : mixed

Instantiate the cache adapter object

Parameters
$ttl : int = 0
$clock : ClockInterface = new ClockSystemClock()

decrementItem()

Always returns $initial - $amount — nothing is ever actually persisted, so every call behaves as if the counter had just been created and immediately decremented once; there is no "first call" state.

public decrementItem(string $id[, int $amount = 1 ][, int $initial = 0 ][, int|null $ttl = null ]) : int
Parameters
$id : string
$amount : int = 1
$initial : int = 0
$ttl : int|null = null
Return values
int

getItem()

Get an item from cache

public getItem(string $id[, mixed $default = false ]) : mixed
Parameters
$id : string
$default : mixed = false

getItemTtl()

Get the time-to-live for an item in cache

public getItemTtl(string $id[, int $default = 0 ]) : int
Parameters
$id : string
$default : int = 0
Return values
int

getTtl()

Get the global time-to-live for the cache object

public getTtl() : int
Return values
int

hasItem()

Determine if the item exist in cache

public hasItem(string $id) : bool
Parameters
$id : string
Return values
bool

incrementItem()

Always returns $initial + $amount — nothing is ever actually persisted, so every call behaves as if the counter had just been created and immediately incremented once; there is no "first call" state.

public incrementItem(string $id[, int $amount = 1 ][, int $initial = 0 ][, int|null $ttl = null ]) : int
Parameters
$id : string
$amount : int = 1
$initial : int = 0
$ttl : int|null = null
Return values
int

saveItem()

Save an item to cache

public saveItem(string $id, mixed $value[, int|null $ttl = null ]) : NullAdapter
Parameters
$id : string
$value : mixed
$ttl : int|null = null
Return values
NullAdapter

isFresh()

Determine if a cache envelope (with 'start'/'ttl' keys) is still within its time-to-live

protected isFresh(array<string|int, mixed> $envelope) : bool
Parameters
$envelope : array<string|int, mixed>
Return values
bool

        
On this page

Search results