feat(redis): view and edit Hash field expiry (HEXPIRE/HTTL/HPERSIST)
This commit is contained in:
12 files changed
+583
-16
No files matched your search
@@ -414,6 +414,8 @@ export const redisSetString = forward("redisSetString");
|
||||
export const redisDeleteKey = forward("redisDeleteKey");
|
||||
export const redisHashSet = forward("redisHashSet");
|
||||
export const redisHashDel = forward("redisHashDel");
|
||||
export const redisHashFieldSetTtl = forward("redisHashFieldSetTtl");
|
||||
export const redisHashFieldSetExpireAt = forward("redisHashFieldSetExpireAt");
|
||||
export const redisListPush = forward("redisListPush");
|
||||
export const redisListSet = forward("redisListSet");
|
||||
export const redisListRemove = forward("redisListRemove");
|
||||
|
||||
@@ -2387,6 +2387,14 @@ export async function redisHashDel(connectionId: string, db: number, keyRaw: str
|
||||
return post("/api/redis/hash-del", { connectionId, db, keyRaw, field });
|
||||
}
|
||||
|
||||
export async function redisHashFieldSetTtl(connectionId: string, db: number, keyRaw: string, field: string, ttl: number): Promise<void> {
|
||||
return post("/api/redis/hash-field-set-ttl", { connectionId, db, keyRaw, field, ttl });
|
||||
}
|
||||
|
||||
export async function redisHashFieldSetExpireAt(connectionId: string, db: number, keyRaw: string, field: string, expireAt: number): Promise<void> {
|
||||
return post("/api/redis/hash-field-set-expire-at", { connectionId, db, keyRaw, field, expireAt });
|
||||
}
|
||||
|
||||
export async function redisListPush(connectionId: string, db: number, keyRaw: string, value: string, ttl?: number): Promise<void> {
|
||||
return post("/api/redis/list-push", { connectionId, db, keyRaw, value, ttl });
|
||||
}
|
||||
|
||||
@@ -2022,6 +2022,7 @@ export interface RedisSetItem {
|
||||
export interface RedisHashItem {
|
||||
field: RedisBlob;
|
||||
value: RedisBlob;
|
||||
field_ttl?: number;
|
||||
}
|
||||
|
||||
export interface RedisZsetItem {
|
||||
@@ -2235,6 +2236,14 @@ export async function redisHashDel(connectionId: string, db: number, keyRaw: str
|
||||
return invoke("redis_hash_del", { connectionId, db, keyRaw, field });
|
||||
}
|
||||
|
||||
export async function redisHashFieldSetTtl(connectionId: string, db: number, keyRaw: string, field: string, ttl: number): Promise<void> {
|
||||
return invoke("redis_hash_field_set_ttl", { connectionId, db, keyRaw, field, ttl });
|
||||
}
|
||||
|
||||
export async function redisHashFieldSetExpireAt(connectionId: string, db: number, keyRaw: string, field: string, expireAt: number): Promise<void> {
|
||||
return invoke("redis_hash_field_set_expire_at", { connectionId, db, keyRaw, field, expireAt });
|
||||
}
|
||||
|
||||
export async function redisListPush(connectionId: string, db: number, keyRaw: string, value: string, ttl?: number): Promise<void> {
|
||||
return invoke("redis_list_push", { connectionId, db, keyRaw, value, ttl });
|
||||
}
|
||||
|
||||
@@ -21,6 +21,8 @@ const ALLOWED_COMMANDS = new Set([
|
||||
"HRANDFIELD",
|
||||
"HSCAN",
|
||||
"HSTRLEN",
|
||||
"HPTTL",
|
||||
"HTTL",
|
||||
"HVALS",
|
||||
"LINDEX",
|
||||
"LLEN",
|
||||
@@ -148,6 +150,11 @@ const CONFIRM_COMMANDS = new Set([
|
||||
"RENAMENX",
|
||||
"GETDEL",
|
||||
"HDEL",
|
||||
"HEXPIRE",
|
||||
"HEXPIREAT",
|
||||
"HPEXPIRE",
|
||||
"HPEXPIREAT",
|
||||
"HPERSIST",
|
||||
"JSON.ARRPOP",
|
||||
"JSON.ARRTRIM",
|
||||
"JSON.CLEAR",
|
||||
|
||||
@@ -166,6 +166,8 @@ const RAW_COMMANDS: Record<string, Spec> = {
|
||||
|
||||
// ---- Hash ----
|
||||
HDEL: [-3, "hash", "confirm"],
|
||||
HEXPIRE: [-6, "hash", "confirm"],
|
||||
HEXPIREAT: [-6, "hash", "confirm"],
|
||||
HEXISTS: [3, "hash"],
|
||||
HGET: [3, "hash"],
|
||||
HGETALL: [2, "hash"],
|
||||
@@ -180,6 +182,11 @@ const RAW_COMMANDS: Record<string, Spec> = {
|
||||
HSET: [-4, "hash", "confirm"],
|
||||
HSETNX: [4, "hash", "confirm"],
|
||||
HSTRLEN: [3, "hash"],
|
||||
HPERSIST: [-5, "hash", "confirm"],
|
||||
HPEXPIRE: [-6, "hash", "confirm"],
|
||||
HPEXPIREAT: [-6, "hash", "confirm"],
|
||||
HPTTL: [-5, "hash"],
|
||||
HTTL: [-5, "hash"],
|
||||
HVALS: [2, "hash"],
|
||||
|
||||
// ---- Set ----
|
||||
|
||||
Reference in new issue
Block a user