const redis: RedisBase;
// 从列表左边插入数据
await redis.lpush('key', 'value');
// 弹出列表左边项
await redis.lpop('key');
// 从列表右边插入数据
await redis.rpush('key', 'value');
// 弹出列右边项
await redis.rpop('key');
// 设置键值
await redis.set('key', 'value');
// 设置键值,并设置过期时间为 10 秒
await redis.set('key', 'value', 'EX', 10);
// 获取键的值(字符串)
await redis.get('key');
// 删除键
await redis.del('key');
// 获取键剩余生存时间
await redis.ttl('key');
// 自增+1
await redis.incr('key');
// 自增+2
await redis.incrBy('key', 2);
// 设置过期时间为 10 秒
await redis.expire('key', 10);
const ioredisAdapter = new IoredisAdapter({
host: '主机地址',
password: '密码',
port: '端口号',
username: '用户名',
});