123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- declare(strict_types=1);
- namespace catcher\library\rate;
- use think\facade\Cache;
- trait Redis
- {
-
- protected $redis = null;
-
- protected function getRedis(): \Redis
- {
- if (!$this->redis) {
- $this->redis = Cache::store('redis')->handler();
- }
- return $this->redis;
- }
-
- public function ttl($ttl)
- {
- $this->ttl = $ttl;
- return $this;
- }
-
- public function limit($limit)
- {
- $this->limit = $limit;
- return $this;
- }
- }
|