Rdb
in package
implements
CacheDriver
Redis-based Cache driver.
Table of Contents
Interfaces
- CacheDriver
- Cache driver interface.
Properties
Methods
- __construct() : mixed
- Create a Redis cache driver.
- delete() : bool
- Delete cache items by id or tag.
- deleteExpired() : void
- Deletes all expired cache items.
- find() : array<string|int, mixed>
- Find all of the cache ids for a given tag.
- get() : mixed
- Get a cache item.
- set() : mixed
- Sets a cache item to the given data, tags, and lifetime.
Properties
$rdb
public
Rdb
$rdb
Methods
__construct()
Create a Redis cache driver.
public
__construct(array<string|int, mixed> $config) : mixed
- host: localhost
- prefix: 'cache:'
- adapter: predis (default) | php-redis | credis
Parameters
- $config : array<string|int, mixed>
Tags
delete()
Delete cache items by id or tag.
public
delete(mixed $id[, mixed $tag = false ]) : bool
Parameters
- $id : mixed
-
true to delete all items
- $tag : mixed = false
-
set true to delete by tag
Tags
Return values
booldeleteExpired()
Deletes all expired cache items.
public
deleteExpired() : void
Tags
find()
Find all of the cache ids for a given tag.
public
find(mixed $tag) : array<string|int, mixed>
Parameters
- $tag : mixed
Tags
Return values
array<string|int, mixed> —[ id => data ]
get()
Get a cache item.
public
get(mixed $id) : mixed
Parameters
- $id : mixed
Tags
set()
Sets a cache item to the given data, tags, and lifetime.
public
set(mixed $id, mixed $data[, array<string|int, mixed>|null $tags = null ][, mixed $lifetime = 0 ]) : mixed
Parameters
- $id : mixed
- $data : mixed
- $tags : array<string|int, mixed>|null = null
- $lifetime : mixed = 0
-
in seconds