PHP code example of oh-my-gold / redis-helper

1. Go to this page and download the library: Download oh-my-gold/redis-helper library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

oh-my-gold / redis-helper example snippets


class TestRdbModel extends BaseRdbModel{}


class TestRdbModel extends BaseRdbModel{
    use RdbTrait\HashTrait;
}

class TestRdbModel extends BaseRdbModel{

    /**
     * 连接配置
     * @var string|array
     */
    protected $connect = 'queue';
    
    /**
     * 键值名前缀 必须
     * @var string
     */
    protected $keyNamePre = 'Demo:TestHash:';

    /**
     * 过期时间 必须
     * int 固定过期时间设定
     * [int, int] 范围时间内随机过期时间设定
     * @var int|int[]
     */
    protected $expireRange = 60;


    use RdbTrait\HashTrait;
}

$rdb_model = new TestRdbModel();
$rdb_model->hSet('key', 'value');
$rdb_model->hGet('key');
$rdb_model->hDel('key');
$rdb_model->hGetAll('key');