RedisCacheStorage
in package
implements
ICacheStorage
Table of Contents
Interfaces
Properties
Methods
- __construct() : mixed
- RedisCacheStorage constructor
- __destruct() : mixed
- Destructor - ensure connection is closed
- clear() : bool
- Clear all cache entries
- delete() : bool
- Delete cache entry
- disconnect() : void
- Disconnect from Redis
- exists() : bool
- Check if cache key exists
- gc() : int
- Run garbage collection to remove expired cache entries
- isConnected() : bool
- Get Redis connection status
- isExpired() : bool
- Check if cache entry is expired
- read() : string|null
- Read content from cache
- reconnect() : bool
- Reconnect to Redis if connection was lost
- write() : bool
- Write content to cache
- connect() : void
- Connect to Redis server
Properties
$_Config
private
array<string|int, mixed>
$_Config
$_Prefix
private
string
$_Prefix
$_Redis
private
Redis|null
$_Redis
= null
Methods
__construct()
RedisCacheStorage constructor
public
__construct([array<string|int, mixed> $Config = [] ]) : mixed
Parameters
- $Config : array<string|int, mixed> = []
-
Redis configuration with keys:
- host: Redis server hostname (default: 127.0.0.1)
- port: Redis server port (default: 6379)
- database: Redis database index (default: 0)
- prefix: Key prefix for cache entries (default: 'neuron_cache_')
- timeout: Connection timeout in seconds (default: 2.0)
- auth: Authentication password (optional)
- persistent: Use persistent connections (default: false)
Tags
__destruct()
Destructor - ensure connection is closed
public
__destruct() : mixed
clear()
Clear all cache entries
public
clear() : bool
Return values
booldelete()
Delete cache entry
public
delete(string $Key) : bool
Parameters
- $Key : string
Return values
booldisconnect()
Disconnect from Redis
public
disconnect() : void
exists()
Check if cache key exists
public
exists(string $Key) : bool
Parameters
- $Key : string
Return values
boolgc()
Run garbage collection to remove expired cache entries
public
gc() : int
Return values
int —Number of entries removed
isConnected()
Get Redis connection status
public
isConnected() : bool
Return values
boolisExpired()
Check if cache entry is expired
public
isExpired(string $Key) : bool
Parameters
- $Key : string
Return values
boolread()
Read content from cache
public
read(string $Key) : string|null
Parameters
- $Key : string
Return values
string|nullreconnect()
Reconnect to Redis if connection was lost
public
reconnect() : bool
Return values
boolwrite()
Write content to cache
public
write(string $Key, string $Content, int $Ttl) : bool
Parameters
- $Key : string
- $Content : string
- $Ttl : int
Tags
Return values
boolconnect()
Connect to Redis server
private
connect() : void