RedisCache class
Framework\Cache\RedisCache
Class RedisCache.
Extends Framework\Cache\Cache
Defined in libraries/cache/src/RedisCache.php
Properties #
$redis
protected Redis $redis
$configs
protected array $configs = array (
'host' => '127.0.0.1',
'port' => 6379,
'timeout' => 0.0,
'password' => NULL,
'database' => NULL,
)
Redis Cache handler configurations.
Methods #
- __construct()
- RedisCache constructor.
- close()
- -
- delete()
- -
- flush()
- -
- get()
- -
- getRedis()
- Get Redis instance or null.
- set()
- -
- setRedis()
- Set custom Redis instance.
- connect()
- -
- getValue()
- -
- initialize()
- -
__construct()
public function __construct(Redis|array|null $configs = array (
), ?string $prefix = NULL, \Framework\Cache\Serializer|string $serializer = \Framework\Cache\Serializer::PHP, ?\Framework\Log\Logger $logger = NULL)
RedisCache constructor.
Parameters
- Redis|array|null $configs - Driver specific configurations. Set null to not initialize or a custom Redis object.
- ?string $prefix - Keys prefix
- \Framework\Cache\Serializer|string $serializer - Data serializer
- ?\Framework\Log\Logger $logger - Logger instance
close()
public function close(): bool
Returns
bool
delete()
public function delete(string $key): bool
Parameters
- string $key
Returns
bool
flush()
public function flush(): bool
Returns
bool
get()
public function get(string $key): mixed
Parameters
- string $key
Returns
mixed
getRedis()
public function getRedis(): ?Redis
Get Redis instance or null.
Returns
?Redis
set()
public function set(string $key, mixed $value, ?int $ttl = NULL): bool
Parameters
- string $key
- mixed $value
- ?int $ttl
Returns
bool
setRedis()
public function setRedis(Redis $redis): static
Set custom Redis instance.
Parameters
- Redis $redis
Returns
static
connect()
protected function connect(): void
Returns
void
getValue()
protected function getValue(string $key): mixed
Parameters
- string $key
Returns
mixed
initialize()
protected function initialize(): void
Returns
void
Inherited methods #
-
__destruct()fromFramework\Cache\Cache -
isAutoClose()fromFramework\Cache\Cache -
setAutoClose()fromFramework\Cache\Cache -
setConfigs()fromFramework\Cache\Cache -
setSerializer()fromFramework\Cache\Cache -
getSerializer()fromFramework\Cache\Cache -
log()fromFramework\Cache\Cache -
getDefaultTtl()fromFramework\Cache\Cache -
setDefaultTtl()fromFramework\Cache\Cache -
makeTtl()fromFramework\Cache\Cache -
getMulti()fromFramework\Cache\Cache -
setMulti()fromFramework\Cache\Cache -
deleteMulti()fromFramework\Cache\Cache -
increment()fromFramework\Cache\Cache -
decrement()fromFramework\Cache\Cache -
renderKey()fromFramework\Cache\Cache -
serialize()fromFramework\Cache\Cache -
unserialize()fromFramework\Cache\Cache -
setDebugCollector()fromFramework\Cache\Cache -
addDebugGet()fromFramework\Cache\Cache -
addDebugSet()fromFramework\Cache\Cache -
addDebugDelete()fromFramework\Cache\Cache -
addDebugFlush()fromFramework\Cache\Cache