redis = Cache::store('redis')->handler(); $this->redis->select($db); } public function incrWithExpire(string $key, int $expireSeconds = 86400) { $val = $this->redis->incr($key); if ($val === 1) { $this->redis->expire($key, $expireSeconds); } return $val; } }