Nextcloud PHP API (master)

CappedMemoryCache
in package
implements ICache, ArrayAccess

In-memory cache with a capacity limit to keep memory usage in check

Uses a simple FIFO expiry mechanism

Tags
since
25.0.0
template

T

template-implements

\ArrayAccess<string,T>

Table of Contents

Interfaces

ICache
This interface defines method for accessing the file based user cache.
ArrayAccess

Properties

$cache  : array<string|int, T>
$capacity  : int

Methods

__construct()  : mixed
clear()  : bool
Clear the user cache of all entries starting with a prefix
get()  : T|null
Get a value from the user cache
getData()  : array<string|int, T>
hasKey()  : bool
Check if a value is set in the user cache
isAvailable()  : bool
Check if the cache implementation is available
offsetExists()  : bool
offsetGet()  : T
offsetSet()  : void
offsetUnset()  : void
remove()  : bool
Remove an item from the user cache
set()  : bool
Set a value in the user cache
garbageCollect()  : void

Properties

Methods

__construct()

public __construct([int $capacity = 512 ]) : mixed
Parameters
$capacity : int = 512
Tags
inheritdoc
since
25.0.0

clear()

Clear the user cache of all entries starting with a prefix

public clear([mixed $prefix = '' ]) : bool
Parameters
$prefix : mixed = ''

(optional)

Tags
inheritdoc
since
25.0.0
Return values
bool

get()

Get a value from the user cache

public get(mixed $key) : T|null
Parameters
$key : mixed
Tags
since
25.0.0
Return values
T|null

getData()

public getData() : array<string|int, T>
Tags
since
25.0.0
Return values
array<string|int, T>

hasKey()

Check if a value is set in the user cache

public hasKey(mixed $key) : bool
Parameters
$key : mixed
Tags
inheritdoc
since
25.0.0
Return values
bool

isAvailable()

Check if the cache implementation is available

public static isAvailable() : bool
Tags
inheritdoc
since
25.0.0
Return values
bool

offsetExists()

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Tags
since
25.0.0
Return values
bool

offsetGet()

public & offsetGet(mixed $offset) : T
Parameters
$offset : mixed
Tags
inheritdoc
since
25.0.0
Return values
T

offsetSet()

public offsetSet(string $offset, T $value) : void
Parameters
$offset : string
$value : T
Tags
inheritdoc
since
25.0.0

offsetUnset()

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed
Tags
inheritdoc
since
25.0.0

remove()

Remove an item from the user cache

public remove(mixed $key) : bool
Parameters
$key : mixed
Tags
since
25.0.0
Return values
bool

set()

Set a value in the user cache

public set(string $key, T $value[, int $ttl = 0 ]) : bool
Parameters
$key : string
$value : T
$ttl : int = 0
Tags
inheritdoc
since
25.0.0
Return values
bool

        
On this page

Search results