Redis
    
            
            in package
            
        
    
    
    
Leaf + Redis [BETA] ---------- Redis made crazy simple
Tags
Table of Contents
Properties
Methods
- __construct() : mixed
- close() : void
- Close the redis connection
- commands() : array<string|int, mixed>
- Get all leaf redis console commands
- connect() : Redis
- Initialize redis and connect to redis instance
- connection() : Adapter
- Get the redis connection
- delete() : bool
- Delete a key from redis
- errors() : array<string|int, mixed>
- Return all saved errors
- exists() : bool
- Check if a key exists in redis
- flush() : bool
- Flush all keys in redis
- get() : string|mixed|false
- Get a redis value
- keys() : array<string|int, mixed>
- Get all keys in redis
- ping() : bool|string
- Ping redis server.
- set() : bool
- Set a redis value
- parseSaveOptions() : mixed
- setSessionHandler() : mixed
Properties
$config
Leaf Redis config
    protected
        array<string|int, mixed>
    $config
     = ['port' => 6379, 'scheme' => 'tcp', 'password' => null, 'host' => '127.0.0.1', 'session' => false, 'session.savePath' => null, 'session.saveOptions' => [], 'connection.timeout' => 0.0, 'connection.reserved' => null, 'connection.retryInterval' => 0, 'connection.readTimeout' => 0.0]
    
    
    
    
$redis
    protected
        Adapter
    $redis
    
    
    
    
    
Methods
__construct()
    public
                    __construct() : mixed
    close()
Close the redis connection
    public
                    close() : void
    commands()
Get all leaf redis console commands
    public
                    commands() : array<string|int, mixed>
    Return values
array<string|int, mixed>connect()
Initialize redis and connect to redis instance
    public
                    connect([array<string|int, mixed> $config = [] ]) : Redis
    Parameters
- $config : array<string|int, mixed> = []
- 
                    Configuration for the redis instance. 
Return values
Redisconnection()
Get the redis connection
    public
                    connection() : Adapter
    Return values
Adapterdelete()
Delete a key from redis
    public
                    delete(string|array<string|int, mixed> $key) : bool
    Parameters
- $key : string|array<string|int, mixed>
- 
                    The key to delete 
Tags
Return values
boolerrors()
Return all saved errors
    public
                    errors() : array<string|int, mixed>
    Return values
array<string|int, mixed>exists()
Check if a key exists in redis
    public
                    exists(string $key) : bool
    Parameters
- $key : string
- 
                    The key to check 
Tags
Return values
boolflush()
Flush all keys in redis
    public
                    flush() : bool
    Tags
Return values
boolget()
Get a redis value
    public
                    get(string|array<string|int, mixed> $key) : string|mixed|false
    Parameters
- $key : string|array<string|int, mixed>
- 
                    The value(s) to get 
Tags
Return values
string|mixed|false —If key didn't exist, FALSE is returned. Otherwise, the value related to this key is returned
keys()
Get all keys in redis
    public
                    keys() : array<string|int, mixed>
    Tags
Return values
array<string|int, mixed>ping()
Ping redis server.
    public
                    ping([string|null $message = null ]) : bool|string
    Parameters
- $message : string|null = null
- 
                    — [optional] 
Tags
Return values
bool|string —TRUE if the command is successful or returns message Throws a RedisException object on connectivity error, as described above
set()
Set a redis value
    public
                    set(string|array<string|int, mixed> $key[, string|mixed $value = "" ][, int|array<string|int, mixed> $timeout = 0 ]) : bool
    Parameters
- $key : string|array<string|int, mixed>
- 
                    The value(s) to set 
- $value : string|mixed = ""
- 
                    — string if not used serializer 
- $timeout : int|array<string|int, mixed> = 0
- 
                    [optional] Calling setex() is preferred if you want a timeout. Since 2.6.12 it also supports different flags inside an array. Example ['NX', 'EX' => 60] - EX seconds -- Set the specified expire time, in seconds.
- PX milliseconds -- Set the specified expire time, in milliseconds.
- NX -- Only set the key if it does not already exist.
- XX -- Only set the key if it already exist. // Simple key -> value set $redis->set('key', 'value'); // Will redirect, and actually make an SETEX call $redis->set('key','value', 10); // Will set the key, if it doesn't exist, with a ttl of 10 seconds $redis->set('key', 'value', ['nx', 'ex' => 10]); // Will set a key, if it does exist, with a ttl of 1000 milliseconds $redis->set('key', 'value', ['xx', 'px' => 1000]);
 
Tags
Return values
bool —— TRUE if the command is successful
parseSaveOptions()
    protected
                    parseSaveOptions() : mixed
    setSessionHandler()
    protected
                    setSessionHandler() : mixed