Redis
extends AbstractAdapter
in package
Redis cache adapter class
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor
- clear() : Redis
- Clear all stored values from cache
- deleteItem() : Redis
- Delete a value in cache
- destroy() : Redis
- Destroy cache resource
- getItem() : mixed
- Get an item from cache
- getItemTtl() : int
- Get the time-to-live for an item in cache
- getTtl() : int
- Get the global time-to-live for the cache object
- getVersion() : string
- Get the current version of redis.
- hasItem() : bool
- Determine if the item exist in cache
- redis() : Redis
- Get the redis object.
- saveItem() : Redis
- Save an item to cache
- setTtl() : AbstractAdapter
- Set the global time-to-live for the cache adapter
Properties
$redis
Redis object
protected
Redis|null
$redis
= null
$ttl
Global time-to-live
protected
int
$ttl
= 0
Methods
__construct()
Constructor
public
__construct([int $ttl = 0 ][, string $host = 'localhost' ][, int $port = 6379 ]) : mixed
Instantiate the memcache cache object
Parameters
- $ttl : int = 0
- $host : string = 'localhost'
- $port : int = 6379
Tags
clear()
Clear all stored values from cache
public
clear() : Redis
Return values
RedisdeleteItem()
Delete a value in cache
public
deleteItem(string $id) : Redis
Parameters
- $id : string
Return values
Redisdestroy()
Destroy cache resource
public
destroy() : Redis
Return values
RedisgetItem()
Get an item from cache
public
getItem(string $id) : mixed
Parameters
- $id : string
getItemTtl()
Get the time-to-live for an item in cache
public
getItemTtl(string $id) : int
Parameters
- $id : string
Return values
intgetTtl()
Get the global time-to-live for the cache object
public
getTtl() : int
Return values
intgetVersion()
Get the current version of redis.
public
getVersion() : string
Return values
stringhasItem()
Determine if the item exist in cache
public
hasItem(string $id) : bool
Parameters
- $id : string
Return values
boolredis()
Get the redis object.
public
redis() : Redis
Return values
RedissaveItem()
Save an item to cache
public
saveItem(string $id, mixed $value[, int|null $ttl = null ]) : Redis
Parameters
- $id : string
- $value : mixed
- $ttl : int|null = null
Return values
RedissetTtl()
Set the global time-to-live for the cache adapter
public
setTtl(int $ttl) : AbstractAdapter
Parameters
- $ttl : int