IMemcache
extends
ICache
in
This interface defines method for accessing the file based user cache.
Tags
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
- dec() : int|bool
- Decrease a stored number
- get() : mixed
- Get a value from the user cache
- 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
Constants
DEFAULT_TTL
public
mixed
DEFAULT_TTL
= 24 * 60 * 60
Tags
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
Return values
boolcad()
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
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
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
Return values
booldec()
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
Return values
int|boolget()
Get a value from the user cache
public
get(string $key) : mixed
Parameters
- $key : string
Tags
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
Return values
boolinc()
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
Return values
int|boolisAvailable()
Check if the cache implementation is available
public
static isAvailable() : bool
Tags
Return values
boolncad()
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
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
Return values
boolset()
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