Nextcloud PHP API (master)

IMemcacheTTL extends IMemcache

Interface for memcache backends that support setting ttl after the value is set

Tags
since
8.2.2

Table of Contents

Constants

DEFAULT_TTL  = 24 * 60 * 60

Methods

add()  : bool
Set a value in the cache if it's not already stored
cad()  : bool
Compare and delete
cas()  : bool
Compare and set
clear()  : bool
Clear the user cache of all entries starting with a prefix
compareSetTTL()  : bool
Set the ttl for an existing value if the value matches
dec()  : int|bool
Decrease a stored number
get()  : mixed
Get a value from the user cache
getTTL()  : int|false
Get the ttl for an existing value, in seconds till expiry
hasKey()  : bool
Check if a value is set in the user cache
inc()  : int|bool
Increase a stored number
isAvailable()  : bool
Check if the cache implementation is available
ncad()  : bool
Negative compare and delete
remove()  : bool
Remove an item from the user cache
set()  : bool
Set a value in the user cache
setTTL()  : mixed
Set the ttl for an existing value

Constants

DEFAULT_TTL

public mixed DEFAULT_TTL = 24 * 60 * 60
Tags
since
30.0.0

Methods

add()

Set a value in the cache if it's not already stored

public add(string $key, mixed $value[, int $ttl = 0 ]) : bool
Parameters
$key : string
$value : mixed
$ttl : int = 0

Time To Live in seconds. Defaults to 606024

Tags
since
8.1.0
Return values
bool

cad()

Compare and delete

public cad(string $key, mixed $old) : bool

Delete $key if the stored value is equal to $old

Parameters
$key : string
$old : mixed
Tags
since
8.1.0
Return values
bool

true if the value was successfully deleted or false if $key wasn't set to $old

cas()

Compare and set

public cas(string $key, mixed $old, mixed $new) : bool

Set $key to $new only if it's current value is $new

Parameters
$key : string
$old : mixed
$new : mixed
Tags
since
8.1.0
Return values
bool

true if the value was successfully set or false if $key wasn't set to $old

clear()

Clear the user cache of all entries starting with a prefix

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

(optional)

Tags
since
6.0.0
Return values
bool

compareSetTTL()

Set the ttl for an existing value if the value matches

public compareSetTTL(string $key, mixed $value, int $ttl) : bool
Parameters
$key : string
$value : mixed
$ttl : int

time to live in seconds

Tags
since
27
Return values
bool

dec()

Decrease a stored number

public dec(string $key[, int $step = 1 ]) : int|bool

If no value is stored with the key, the operation will fail and false is returned. If a non-numeric value is stored, the operation will fail and false is returned.

Parameters
$key : string
$step : int = 1
Tags
since
8.1.0
Return values
int|bool

get()

Get a value from the user cache

public get(string $key) : mixed
Parameters
$key : string
Tags
since
6.0.0

getTTL()

Get the ttl for an existing value, in seconds till expiry

public getTTL(string $key) : int|false
Parameters
$key : string
Tags
since
27
Return values
int|false

hasKey()

Check if a value is set in the user cache

public hasKey(string $key) : bool

Directly read from GET to prevent race conditions

Parameters
$key : string
Tags
since
6.0.0
Return values
bool

inc()

Increase a stored number

public inc(string $key[, int $step = 1 ]) : int|bool

If no value is stored with the key, it will behave as if a 0 was stored. If a non-numeric value is stored, the operation will fail and false is returned.

Parameters
$key : string
$step : int = 1
Tags
since
8.1.0
Return values
int|bool

isAvailable()

Check if the cache implementation is available

public static isAvailable() : bool
Tags
since
24.0.0
Return values
bool

ncad()

Negative compare and delete

public ncad(string $key, mixed $old) : bool

Delete $key if the stored value is not equal to $old

Parameters
$key : string
$old : mixed
Tags
since
30.0.0
Return values
bool

true if the value was successfully deleted or false if $key was set to $old or is not set

remove()

Remove an item from the user cache

public remove(string $key) : bool
Parameters
$key : string
Tags
since
6.0.0
Return values
bool

set()

Set a value in the user cache

public set(string $key, mixed $value[, int $ttl = 0 ]) : bool
Parameters
$key : string
$value : mixed
$ttl : int = 0

Time To Live in seconds. Defaults to 606024

Tags
since
6.0.0
Return values
bool

setTTL()

Set the ttl for an existing value

public setTTL(string $key, int $ttl) : mixed
Parameters
$key : string
$ttl : int

time to live in seconds

Tags
since
8.2.2

        
On this page

Search results