lijinhua / hyperf-redis-repository
适用于hyperf的redis存储库管理
v1.0.0
2023-11-08 06:24 UTC
Requires
- php: >=8.0
- ext-redis: *
- hyperf/di: 3.0.*
- hyperf/framework: 3.0.*
- hyperf/redis: ^3.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- mockery/mockery: ^1.0
- phpstan/phpstan: ^1.0
- phpunit/phpunit: >=7.0
- swoole/ide-helper: ^4.5
Suggests
- swow/swow: Required to create swow components.
This package is auto-updated.
Last update: 2025-03-08 09:16:30 UTC
README
适用于hyperf的redis存储库管理,统一分类存储redis
安装
composer require lijinhua/hyperf-redis-repository
使用
<?php 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();