CoreCache
in package
$this->core->cache Class to manage Cache in your solutions.
https://cloud.google.com/appengine/docs/standard/php7/using-memorystore#setup_redis_db
Table of Contents
Properties
- $atom : mixed
- $cache : mixed
- $core : Core
- $debug : mixed
- $dir : mixed
- $error : mixed
- $errorMsg : mixed
- $errorSecurity : mixed
- $lastExpireTime : mixed
- $lastHash : mixed
- $spacename : mixed
- $type : mixed
Methods
- __construct() : mixed
- CoreCache constructor. If $type==CacheInDirectory a writable $path is required
- activateCacheFile() : bool
- Activate cache in files.. It requires that the path will be writtable
- activateDataStore() : bool
- Activate cache in Datastore.. It requires Core Class
- activateMemory() : bool
- Activate cache in memory
- addError() : mixed
- Set error in the class
- delete() : true|null
- delete a $key from cache
- get() : bool|mixed|null
- Return an object from Cache.
- getByExpireTime() : bool|mixed|null
- Return a cache based in the Expiration time = TimeToSave + $seconds
- getByHash() : bool|mixed|null
- Return a cache based in a hash previously assigned in set
- init() : bool
- Initialiated Cache Memory object.. If previously it has been called it just returns true.. if there is an error it returns false.. https://cloud.google.com/appengine/docs/standard/php7/php-differences App Engine Memcache support is not provided. Instead, use Memorystore for Redis.
- keys() : array<string|int, mixed>|null
- Return the keys stored in the cache under $this->spacename
- set() : bool
- Set an object on cache based on $key
- setSpaceName() : mixed
- Set a $spacename to set/get $objects
Properties
$atom
public
mixed
$atom
= \null
$cache
public
mixed
$cache
= \null
$core
public
Core
$core
= \null
$debug
public
mixed
$debug
= \false
$dir
public
mixed
$dir
= ''
$error
public
mixed
$error
= \false
$errorMsg
public
mixed
$errorMsg
= []
$errorSecurity
public
mixed
$errorSecurity
= \false
$lastExpireTime
public
mixed
$lastExpireTime
= \null
$lastHash
public
mixed
$lastHash
= \null
$spacename
public
mixed
$spacename
= 'CloudFrameWork'
$type
public
mixed
$type
= 'memory'
Methods
__construct()
CoreCache constructor. If $type==CacheInDirectory a writable $path is required
public
__construct(Core7 &$core[, string $spacename = '' ][, string $path = null ][, mixed $debug = null ]) : mixed
Parameters
- $core : Core7
- $spacename : string = ''
- $path : string = null
-
if != null the it assumes the cache will be store in files
- $debug : mixed = null
activateCacheFile()
Activate cache in files.. It requires that the path will be writtable
public
activateCacheFile(string $path[, string $spacename = '' ]) : bool
Parameters
- $path : string
-
dir path to keep files.
- $spacename : string = ''
Return values
boolactivateDataStore()
Activate cache in Datastore.. It requires Core Class
public
activateDataStore([string $spacename = '' ]) : bool
Parameters
- $spacename : string = ''
-
spacename where to store objecs
Return values
boolactivateMemory()
Activate cache in memory
public
activateMemory() : bool
Return values
booladdError()
Set error in the class
public
addError( $value) : mixed
Parameters
delete()
delete a $key from cache
public
delete( $key) : true|null
Parameters
Return values
true|nullget()
Return an object from Cache.
public
get( $key[, int $expireTime = -1 ][, string $hash = '' ][, string $cache_secret_key = '' ][, string $cache_secret_iv = '' ]) : bool|mixed|null
Parameters
- $key :
- $expireTime : int = -1
-
The default value es -1. If you want to expire, you can use a value in seconds.
- $hash : string = ''
-
if != '' evaluate if the $hash match with hash stored in cache.. If not, delete the cache and return false;
- $cache_secret_key : string = ''
-
optional secret key. If not empty it will encrypt the data in cache
- $cache_secret_iv : string = ''
-
optional secret key. If not empty it will encrypt the data in cache
Return values
bool|mixed|nullgetByExpireTime()
Return a cache based in the Expiration time = TimeToSave + $seconds
public
getByExpireTime(string $str, int $seconds) : bool|mixed|null
Parameters
- $str : string
- $seconds : int
Return values
bool|mixed|nullgetByHash()
Return a cache based in a hash previously assigned in set
public
getByHash( $str, $hash) : bool|mixed|null
Parameters
Return values
bool|mixed|nullinit()
Initialiated Cache Memory object.. If previously it has been called it just returns true.. if there is an error it returns false.. https://cloud.google.com/appengine/docs/standard/php7/php-differences App Engine Memcache support is not provided. Instead, use Memorystore for Redis.
public
init() : bool
https://cloud.google.com/appengine/docs/standard/php7/using-memorystore
Return values
boolkeys()
Return the keys stored in the cache under $this->spacename
public
keys([ $search = '*' ]) : array<string|int, mixed>|null
Parameters
Return values
array<string|int, mixed>|null —if there is some error it will return null else the array of keys found
set()
Set an object on cache based on $key
public
set( $key, mixed $object[, string $hash = null ][, string $cache_secret_key = '' ][, string $cache_secret_iv = '' ]) : bool
Parameters
- $key :
- $object : mixed
- $hash : string = null
-
Allow to set the info based in a hash to determine if it is valid when read it.
- $cache_secret_key : string = ''
-
optional secret key. If not empty it will encrypt the data en cache
- $cache_secret_iv : string = ''
-
optional secret key. If not empty it will encrypt the data en cache
Return values
boolsetSpaceName()
Set a $spacename to set/get $objects
public
setSpaceName(string $name) : mixed
Parameters
- $name : string