diff --git a/app/Cache/Redis/RedisCache.php b/app/Cache/Redis/RedisCache.php index 60508ea..488fdf7 100644 --- a/app/Cache/Redis/RedisCache.php +++ b/app/Cache/Redis/RedisCache.php @@ -83,6 +83,29 @@ class RedisCache return $this->delete($key, $poolName); } + /** + * 接下来的操作启用原子操作 - 事物开启 + * @param string $poolName + * @return bool|Redis + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function multi(string $poolName = 'default'): bool|Redis + { + return $this->getRedis($poolName)->multi(); + } + + /** + * 结束原子操作 - 事物结束 + * @param string $poolName + * @return Redis|array|false + * @throws ContainerExceptionInterface + * @throws NotFoundExceptionInterface + */ + public function exec(string$poolName = 'default'): Redis|array|false + { + return $this->getRedis($poolName)->exec(); + } // +-------------------------------------------------------------------------------------------------------------------------------------------- // | key