Cache
in package
Cache main class.
Table of Contents
- LONG = 3600
- MEDIUM = 300
- SHORT = 60
- $clearOpcache : bool
- Clean the opcache after the script finishes.
- $pool : mixed
- $staticPool : mixed
- clear() : bool
- Deletes all items in the cache.
- clearAll() : void
- Clear all cache.
- clearOpcache() : bool
- Clear the opcache after the script finishes.
- clearTemporaryFiles() : array<string|int, int>
- Clean old cache files.
- delete() : bool
- Removes the item from the cache.
- get() : mixed
- Returns a Cache Item representing the specified key.
- has() : bool
- Confirms if the cache contains specified cache item.
- init() : mixed
- Initialize cache class.
- resetFileCache() : void
- Reset file from opcache if it is possible.
- resetOpcache() : void
- Reset opcache if it is possible.
- save() : bool
- Cache Save.
- staticClear() : bool
- Deletes all items in the static cache.
- staticDelete() : bool
- Removes the item from the static cache.
- staticGet() : mixed
- Returns a static Cache Item representing the specified key.
- staticHas() : bool
- Confirms if the static cache contains specified cache item.
- staticSave() : bool
- Static cache save.
Constants
LONG
public
int
LONG
= 3600
Long time data storage
MEDIUM
public
int
MEDIUM
= 300
Medium time data storage
SHORT
public
int
SHORT
= 60
Short time data storage
Properties
$clearOpcache
Clean the opcache after the script finishes.
public
static bool
$clearOpcache
= false
$pool
public
static mixed
$pool
$staticPool
public
static mixed
$staticPool
Methods
clear()
Deletes all items in the cache.
public
static clear() : bool
Return values
bool —clearAll()
Clear all cache.
public
static clearAll() : void
Return values
void —clearOpcache()
Clear the opcache after the script finishes.
public
static clearOpcache() : bool
Return values
bool —clearTemporaryFiles()
Clean old cache files.
public
static clearTemporaryFiles([string $days = '-30 day' ]) : array<string|int, int>
Parameters
- $days : string = '-30 day'
Return values
array<string|int, int> —delete()
Removes the item from the cache.
public
static delete(mixed $nameSpace, string $key) : bool
Parameters
- $nameSpace : mixed
- $key : string
-
Cache ID
Return values
bool —get()
Returns a Cache Item representing the specified key.
public
static get(mixed $nameSpace, string $key) : mixed
Parameters
- $nameSpace : mixed
- $key : string
-
Cache ID
Return values
mixed —has()
Confirms if the cache contains specified cache item.
public
static has(string $nameSpace, string $key) : bool
Parameters
- $nameSpace : string
- $key : string
-
Cache ID
Return values
bool —init()
Initialize cache class.
public
static init() : mixed
Return values
mixed —resetFileCache()
Reset file from opcache if it is possible.
public
static resetFileCache(string $path) : void
Parameters
- $path : string
Return values
void —resetOpcache()
Reset opcache if it is possible.
public
static resetOpcache() : void
Return values
void —save()
Cache Save.
public
static save(mixed $nameSpace, string $key[, mixed $value = null ][, int $duration = self::MEDIUM ]) : bool
Parameters
- $nameSpace : mixed
- $key : string
-
Cache ID
- $value : mixed = null
-
Data to store, supports string, array, objects
- $duration : int = self::MEDIUM
-
Cache TTL (in seconds)
Return values
bool —staticClear()
Deletes all items in the static cache.
public
static staticClear() : bool
Return values
bool —staticDelete()
Removes the item from the static cache.
public
static staticDelete(string $nameSpace, string $key) : bool
Parameters
- $nameSpace : string
- $key : string
-
Cache ID
Return values
bool —staticGet()
Returns a static Cache Item representing the specified key.
public
static staticGet(string $nameSpace[, string $key = '' ]) : mixed
Parameters
- $nameSpace : string
- $key : string = ''
-
Cache ID
Return values
mixed —staticHas()
Confirms if the static cache contains specified cache item.
public
static staticHas(string $nameSpace[, string $key = '' ]) : bool
Parameters
- $nameSpace : string
- $key : string = ''
-
Cache ID
Return values
bool —staticSave()
Static cache save.
public
static staticSave(string $nameSpace, string $key[, mixed $value = null ]) : bool
Parameters
- $nameSpace : string
- $key : string
-
Cache ID
- $value : mixed = null
-
Data to store