CFileCache
in package
implements
ICache
Class CFileCache implement the Cache on File in Debian the repository is on the virtual disk /dev/shm/ based on ICache
NOTE: In all code, do NOT use this class, but its extension CCache!
Tags
Interfaces, Classes, Traits and Enums
- ICache
- Interface 'ICache' for caching data and pages
Table of Contents
- MAIN_CACHE_PATH = CACHE_PATH
- $area_name : string
- $CACHE_PATH : string
- $uid : int
- __construct() : mixed
- clear() : void
- Reset all cache
- clearArea() : void
- Remove all items of an area
- delete() : void
- Delete a certain key if it exists
- exists() : bool
- Check if a key exists and is in the cache
- existsGlobal() : bool
- Check if a key exists for all user and is in the cache
- get() : mixed
- Get the value of an stored element
- getCacheNames() : array<string|int, string>|bool
- Provides the list of cached file names
- getCachePath() : string
- Returns the path where it writes the cache files
- getGlobal() : mixed
- Get the value of an stored element valid for all users
- getName() : string
- Given the name of a key determines the actual internal key to be used
- set() : void
- Sets the value of an item to be stored
- setArea() : void
- Set the name of current area
- setGlobal() : void
- Sets the value of an item to be stored valid for all user
- setUid() : void
- Set the id of current user
- writeDebug() : void
- Writes a message to a cache-specific log file
- _createPathIfNotExists() : void
- Create all folder's Path on file system if not exist
Constants
MAIN_CACHE_PATH
private
mixed
MAIN_CACHE_PATH
= CACHE_PATH
Tags
Properties
$area_name
private
string
$area_name
Tags
$CACHE_PATH
private
string
$CACHE_PATH
Tags
$uid
private
int
$uid
Tags
Methods
__construct()
public
__construct(string $domain[, string $app_name = APP_NAME ][, string $area_name = '' ][, int $uid = 0 ]) : mixed
Parameters
- $domain : string
-
application domain (unique name for each app)
- $app_name : string = APP_NAME
-
name of App (default APP_NAME)
- $area_name : string = ''
-
name of area
- $uid : int = 0
-
the id of current user in table _user (optional)
Tags
Return values
mixed —clear()
Reset all cache
public
clear([ $needle = '*' ]) : void
Parameters
- $needle : = '*'
-
Removes all keys containing the key name, if $needle is empty string than remove all
Tags
Return values
void —clearArea()
Remove all items of an area
public
clearArea(string $area_name) : void
Parameters
- $area_name : string
-
name of area
Tags
Return values
void —delete()
Delete a certain key if it exists
public
delete(string $name) : void
Parameters
- $name : string
-
name of the key to be deleted
Tags
Return values
void —exists()
Check if a key exists and is in the cache
public
exists(string $name[, string|null $area_name = null ]) : bool
Parameters
- $name : string
-
message to write on file log
- $area_name : string|null = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
bool —true if the key $name exists
existsGlobal()
Check if a key exists for all user and is in the cache
public
existsGlobal(string $name[, string|null $area_name = null ]) : bool
Parameters
- $name : string
-
key of the item to be stored
- $area_name : string|null = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
bool —true if the key $name exists
get()
Get the value of an stored element
public
get(string $name[, string $area_name = null ]) : mixed
Parameters
- $name : string
-
key of the item to be stored
- $area_name : string = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
mixed —The cached element value: it can be a scalar value, an object or an array
getCacheNames()
Provides the list of cached file names
public
getCacheNames() : array<string|int, string>|bool
Tags
Return values
array<string|int, string>|bool —an array with a list of cached file name or false if there are none
getCachePath()
Returns the path where it writes the cache files
public
getCachePath() : string
Tags
Return values
string —the cache path of the application
getGlobal()
Get the value of an stored element valid for all users
public
getGlobal(string $name[, string $area_name = null ]) : mixed
Parameters
- $name : string
-
key of the item to be stored
- $area_name : string = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
mixed —The cached element value: it can be a scalar value, an object or an array
getName()
Given the name of a key determines the actual internal key to be used
public
getName(string $name) : string
Parameters
- $name : string
-
message to write on file log
Tags
Return values
string —the internal key
set()
Sets the value of an item to be stored
public
set(string $name, mixed $value[, string|null $area_name = null ]) : void
Parameters
- $name : string
-
key of the item to be stored
- $value : mixed
-
value to be stored
- $area_name : string|null = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
void —setArea()
Set the name of current area
public
setArea(string $area_name) : void
Parameters
- $area_name : string
-
name of area
Tags
Return values
void —setGlobal()
Sets the value of an item to be stored valid for all user
public
setGlobal(string $name, mixed $value[, string|null $area_name = null ]) : void
Parameters
- $name : string
-
key of the item to be stored
- $value : mixed
-
value to be stored
- $area_name : string|null = null
-
name of area (null or not declared is the implicit "current area")
Tags
Return values
void —setUid()
Set the id of current user
public
setUid(int $uid) : void
Parameters
- $uid : int
-
id of current user (optional)
Tags
Return values
void —writeDebug()
Writes a message to a cache-specific log file
public
writeDebug(mixed $msg) : void
Parameters
- $msg : mixed
-
string message or object to write on file log
Tags
Return values
void —_createPathIfNotExists()
Create all folder's Path on file system if not exist
private
_createPathIfNotExists(string $path) : void
Parameters
- $path : string
-
path to create if not exists