createRedisClient() createRedisClient(array $configList) : \Redis Parameters array $configList Returns \Redis —
set() set(string $key, mixed $value, int $ttl, bool $nx = false) : bool Parameters string $key mixed $value int $ttl bool $nx Returns bool —
hSet() hSet(string $hash, string $field, mixed $value) : int Parameters string $hash string $field mixed $value Returns int —
hGet() hGet(string $hash, string $field) : mixed Parameters string $hash string $field Returns mixed —
lock() lock(string $key, int $ttl = 10, int $renewTtl = null) : false|string 获取分布式锁(带自动续期). Parameters string $key 锁名称 int $ttl 初始过期时间(秒) int $renewTtl 续期时间(秒),建议为 ttl 的 1/3 Returns false|string — 成功返回唯一 token,失败返回 false
unlock() unlock(string $key, string $token) : void 释放锁(安全删除 + 清理续期任务). Parameters string $key 锁名称 string $token 加锁时返回的 token
transaction() transaction(callable $callback) : array 事务封装. Parameters callable $callback Returns array —