PHP code example of lijinhua / hyperf-redis-repository

1. Go to this page and download the library: Download lijinhua/hyperf-redis-repository 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/ */

    

lijinhua / hyperf-redis-repository example snippets




namespace App\Cache;

use Lijinhua\HyperfRedisRepository\Repository\HashRedis;

class UserCache extends HashRedis
{
    public string $name = 'user';
}



\App\Cache\UserCache::getInstance()->add('uid-1000',json_encode(['age'=>20,'sex'=>'man']));

\App\Cache\UserCache::getInstance()->get('uid-1000');

\App\Cache\UserCache::getInstance()->rem('uid-1000');

\App\Cache\UserCache::getInstance()->delete();