@upstash/redis 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/{chunk-RLVWMRRX.mjs → chunk-CGMWROAN.mjs} +557 -4
- package/cloudflare.d.mts +2 -2
- package/cloudflare.d.ts +2 -2
- package/cloudflare.js +557 -4
- package/cloudflare.mjs +1 -1
- package/docs/advanced.mdx +83 -0
- package/docs/commands/array/arcount.mdx +28 -0
- package/docs/commands/array/ardel.mdx +30 -0
- package/docs/commands/array/ardelrange.mdx +32 -0
- package/docs/commands/array/arget.mdx +33 -0
- package/docs/commands/array/argetrange.mdx +38 -0
- package/docs/commands/array/argrep.mdx +69 -0
- package/docs/commands/array/arinfo.mdx +49 -0
- package/docs/commands/array/arinsert.mdx +32 -0
- package/docs/commands/array/arlastitems.mdx +40 -0
- package/docs/commands/array/arlen.mdx +28 -0
- package/docs/commands/array/armget.mdx +31 -0
- package/docs/commands/array/armset.mdx +31 -0
- package/docs/commands/array/arnext.mdx +25 -0
- package/docs/commands/array/arop.mdx +44 -0
- package/docs/commands/array/arring.mdx +36 -0
- package/docs/commands/array/arscan.mdx +42 -0
- package/docs/commands/array/arseek.mdx +34 -0
- package/docs/commands/array/arset.mdx +35 -0
- package/docs/commands/auth/echo.mdx +24 -0
- package/docs/commands/auth/ping.mdx +21 -0
- package/docs/commands/bitmap/bitcount.mdx +39 -0
- package/docs/commands/bitmap/bitop.mdx +142 -0
- package/docs/commands/bitmap/bitpos.mdx +39 -0
- package/docs/commands/bitmap/getbit.mdx +28 -0
- package/docs/commands/bitmap/setbit.mdx +31 -0
- package/docs/commands/connection/client_setinfo.mdx +91 -0
- package/docs/commands/functions/call.mdx +72 -0
- package/docs/commands/functions/call_ro.mdx +57 -0
- package/docs/commands/functions/delete.mdx +22 -0
- package/docs/commands/functions/flush.mdx +16 -0
- package/docs/commands/functions/list.mdx +72 -0
- package/docs/commands/functions/load.mdx +64 -0
- package/docs/commands/functions/stats.mdx +46 -0
- package/docs/commands/generic/del.mdx +29 -0
- package/docs/commands/generic/exists.mdx +26 -0
- package/docs/commands/generic/expire.mdx +29 -0
- package/docs/commands/generic/expireat.mdx +29 -0
- package/docs/commands/generic/keys.mdx +32 -0
- package/docs/commands/generic/persist.mdx +23 -0
- package/docs/commands/generic/pexpire.mdx +28 -0
- package/docs/commands/generic/pexpireat.mdx +29 -0
- package/docs/commands/generic/pttl.mdx +23 -0
- package/docs/commands/generic/randomkey.mdx +21 -0
- package/docs/commands/generic/rename.mdx +28 -0
- package/docs/commands/generic/renamenx.mdx +28 -0
- package/docs/commands/generic/scan.mdx +38 -0
- package/docs/commands/generic/touch.mdx +23 -0
- package/docs/commands/generic/ttl.mdx +23 -0
- package/docs/commands/generic/type.mdx +27 -0
- package/docs/commands/generic/unlink.mdx +29 -0
- package/docs/commands/hash/hdel.mdx +28 -0
- package/docs/commands/hash/hexists.mdx +30 -0
- package/docs/commands/hash/hexpire.mdx +49 -0
- package/docs/commands/hash/hexpireat.mdx +48 -0
- package/docs/commands/hash/hexpiretime.mdx +35 -0
- package/docs/commands/hash/hget.mdx +29 -0
- package/docs/commands/hash/hgetall.mdx +27 -0
- package/docs/commands/hash/hgetdel.mdx +67 -0
- package/docs/commands/hash/hgetex.mdx +123 -0
- package/docs/commands/hash/hincrby.mdx +34 -0
- package/docs/commands/hash/hincrbyfloat.mdx +34 -0
- package/docs/commands/hash/hkeys.mdx +28 -0
- package/docs/commands/hash/hlen.mdx +28 -0
- package/docs/commands/hash/hmget.mdx +33 -0
- package/docs/commands/hash/hpersist.mdx +37 -0
- package/docs/commands/hash/hpexpire.mdx +50 -0
- package/docs/commands/hash/hpexpireat.mdx +48 -0
- package/docs/commands/hash/hpexpiretime.mdx +35 -0
- package/docs/commands/hash/hpttl.mdx +35 -0
- package/docs/commands/hash/hrandfield.mdx +57 -0
- package/docs/commands/hash/hscan.mdx +65 -0
- package/docs/commands/hash/hset.mdx +32 -0
- package/docs/commands/hash/hsetex.mdx +186 -0
- package/docs/commands/hash/hsetnx.mdx +30 -0
- package/docs/commands/hash/hstrlen.mdx +28 -0
- package/docs/commands/hash/httl.mdx +35 -0
- package/docs/commands/hash/hvals.mdx +29 -0
- package/docs/commands/json/arrappend.mdx +35 -0
- package/docs/commands/json/arrindex.mdx +37 -0
- package/docs/commands/json/arrinsert.mdx +34 -0
- package/docs/commands/json/arrlen.mdx +26 -0
- package/docs/commands/json/arrpop.mdx +36 -0
- package/docs/commands/json/arrtrim.mdx +34 -0
- package/docs/commands/json/clear.mdx +30 -0
- package/docs/commands/json/del.mdx +26 -0
- package/docs/commands/json/forget.mdx +26 -0
- package/docs/commands/json/get.mdx +53 -0
- package/docs/commands/json/merge.mdx +32 -0
- package/docs/commands/json/mget.mdx +27 -0
- package/docs/commands/json/mset.mdx +26 -0
- package/docs/commands/json/numincrby.mdx +33 -0
- package/docs/commands/json/nummultby.mdx +33 -0
- package/docs/commands/json/objkeys.mdx +27 -0
- package/docs/commands/json/objlen.mdx +27 -0
- package/docs/commands/json/set.mdx +42 -0
- package/docs/commands/json/strappend.mdx +32 -0
- package/docs/commands/json/strlen.mdx +26 -0
- package/docs/commands/json/toggle.mdx +28 -0
- package/docs/commands/json/type.mdx +28 -0
- package/docs/commands/list/lindex.mdx +32 -0
- package/docs/commands/list/linsert.mdx +41 -0
- package/docs/commands/list/llen.mdx +26 -0
- package/docs/commands/list/lmove.mdx +34 -0
- package/docs/commands/list/lpop.mdx +37 -0
- package/docs/commands/list/lpos.mdx +56 -0
- package/docs/commands/list/lpush.mdx +32 -0
- package/docs/commands/list/lpushx.mdx +38 -0
- package/docs/commands/list/lrange.mdx +37 -0
- package/docs/commands/list/lrem.mdx +33 -0
- package/docs/commands/list/lset.mdx +34 -0
- package/docs/commands/list/ltrim.mdx +33 -0
- package/docs/commands/list/rpop.mdx +37 -0
- package/docs/commands/list/rpush.mdx +32 -0
- package/docs/commands/list/rpushx.mdx +38 -0
- package/docs/commands/overview.mdx +692 -0
- package/docs/commands/pubsub/psubscribe.mdx +36 -0
- package/docs/commands/pubsub/publish.mdx +27 -0
- package/docs/commands/pubsub/subscribe.mdx +28 -0
- package/docs/commands/scripts/eval.mdx +36 -0
- package/docs/commands/scripts/eval_ro.mdx +36 -0
- package/docs/commands/scripts/evalsha.mdx +36 -0
- package/docs/commands/scripts/evalsha_ro.mdx +36 -0
- package/docs/commands/scripts/script_exists.mdx +26 -0
- package/docs/commands/scripts/script_flush.mdx +28 -0
- package/docs/commands/scripts/script_load.mdx +28 -0
- package/docs/commands/server/dbsize.mdx +22 -0
- package/docs/commands/server/flushall.mdx +25 -0
- package/docs/commands/server/flushdb.mdx +25 -0
- package/docs/commands/set/sadd.mdx +32 -0
- package/docs/commands/set/scard.mdx +26 -0
- package/docs/commands/set/sdiff.mdx +27 -0
- package/docs/commands/set/sdiffstore.mdx +32 -0
- package/docs/commands/set/sinter.mdx +27 -0
- package/docs/commands/set/sinterstore.mdx +33 -0
- package/docs/commands/set/sismember.mdx +30 -0
- package/docs/commands/set/smembers.mdx +25 -0
- package/docs/commands/set/smismember.mdx +31 -0
- package/docs/commands/set/smove.mdx +34 -0
- package/docs/commands/set/spop.mdx +36 -0
- package/docs/commands/set/srandmember.mdx +36 -0
- package/docs/commands/set/srem.mdx +29 -0
- package/docs/commands/set/sscan.mdx +39 -0
- package/docs/commands/set/sunion.mdx +27 -0
- package/docs/commands/set/sunionstore.mdx +33 -0
- package/docs/commands/stream/xack.mdx +37 -0
- package/docs/commands/stream/xackdel.mdx +211 -0
- package/docs/commands/stream/xadd.mdx +137 -0
- package/docs/commands/stream/xautoclaim.mdx +80 -0
- package/docs/commands/stream/xclaim.mdx +84 -0
- package/docs/commands/stream/xdel.mdx +34 -0
- package/docs/commands/stream/xdelex.mdx +119 -0
- package/docs/commands/stream/xgroup.mdx +141 -0
- package/docs/commands/stream/xinfo.mdx +77 -0
- package/docs/commands/stream/xlen.mdx +22 -0
- package/docs/commands/stream/xpending.mdx +75 -0
- package/docs/commands/stream/xrange.mdx +59 -0
- package/docs/commands/stream/xread.mdx +65 -0
- package/docs/commands/stream/xreadgroup.mdx +87 -0
- package/docs/commands/stream/xrevrange.mdx +65 -0
- package/docs/commands/stream/xtrim.mdx +75 -0
- package/docs/commands/string/append.mdx +28 -0
- package/docs/commands/string/decr.mdx +27 -0
- package/docs/commands/string/decrby.mdx +30 -0
- package/docs/commands/string/get.mdx +34 -0
- package/docs/commands/string/getdel.mdx +29 -0
- package/docs/commands/string/getrange.mdx +34 -0
- package/docs/commands/string/getset.mdx +28 -0
- package/docs/commands/string/incr.mdx +27 -0
- package/docs/commands/string/incrby.mdx +30 -0
- package/docs/commands/string/incrbyfloat.mdx +30 -0
- package/docs/commands/string/mget.mdx +31 -0
- package/docs/commands/string/mset.mdx +32 -0
- package/docs/commands/string/msetnx.mdx +29 -0
- package/docs/commands/string/set.mdx +79 -0
- package/docs/commands/string/setrange.mdx +38 -0
- package/docs/commands/string/strlen.mdx +26 -0
- package/docs/commands/transaction.mdx +22 -0
- package/docs/commands/zset/zadd.mdx +102 -0
- package/docs/commands/zset/zcard.mdx +31 -0
- package/docs/commands/zset/zcount.mdx +47 -0
- package/docs/commands/zset/zdiffstore.mdx +33 -0
- package/docs/commands/zset/zincrby.mdx +37 -0
- package/docs/commands/zset/zinterstore.mdx +98 -0
- package/docs/commands/zset/zlexcount.mdx +43 -0
- package/docs/commands/zset/zmscore.mdx +34 -0
- package/docs/commands/zset/zpopmax.mdx +25 -0
- package/docs/commands/zset/zpopmin.mdx +25 -0
- package/docs/commands/zset/zrange.mdx +85 -0
- package/docs/commands/zset/zrank.mdx +29 -0
- package/docs/commands/zset/zrem.mdx +33 -0
- package/docs/commands/zset/zremrangebylex.mdx +32 -0
- package/docs/commands/zset/zremrangebyrank.mdx +32 -0
- package/docs/commands/zset/zremrangebyscore.mdx +32 -0
- package/docs/commands/zset/zrevrank.mdx +29 -0
- package/docs/commands/zset/zscan.mdx +58 -0
- package/docs/commands/zset/zscore.mdx +34 -0
- package/docs/commands/zset/zunionstore.mdx +98 -0
- package/docs/deployment.mdx +117 -0
- package/docs/developing.mdx +118 -0
- package/docs/getstarted.mdx +68 -0
- package/docs/overview.mdx +29 -0
- package/docs/pipelining/auto-pipeline.mdx +108 -0
- package/docs/pipelining/pipeline-transaction.mdx +65 -0
- package/docs/retries.mdx +24 -0
- package/docs/troubleshooting.mdx +80 -0
- package/{error-BNzLTXJG.d.mts → error-4e36-PC0.d.mts} +838 -8
- package/{error-BNzLTXJG.d.ts → error-4e36-PC0.d.ts} +838 -8
- package/fastly.d.mts +2 -2
- package/fastly.d.ts +2 -2
- package/fastly.js +557 -4
- package/fastly.mjs +1 -1
- package/nodejs.d.mts +34 -2
- package/nodejs.d.ts +34 -2
- package/nodejs.js +586 -4
- package/nodejs.mjs +30 -1
- package/package.json +16 -5
- package/src/pkg/auto-pipeline.ts +284 -0
- package/src/pkg/commands/append.ts +12 -0
- package/src/pkg/commands/arcount.ts +14 -0
- package/src/pkg/commands/ardel.ts +19 -0
- package/src/pkg/commands/ardelrange.ts +19 -0
- package/src/pkg/commands/arget.ts +17 -0
- package/src/pkg/commands/argetrange.ts +20 -0
- package/src/pkg/commands/argrep.ts +109 -0
- package/src/pkg/commands/arinfo.ts +88 -0
- package/src/pkg/commands/arinsert.ts +24 -0
- package/src/pkg/commands/arlastitems.ts +29 -0
- package/src/pkg/commands/arlen.ts +23 -0
- package/src/pkg/commands/armget.ts +18 -0
- package/src/pkg/commands/armset.ts +26 -0
- package/src/pkg/commands/arnext.ts +20 -0
- package/src/pkg/commands/arop.ts +48 -0
- package/src/pkg/commands/arring.ts +23 -0
- package/src/pkg/commands/arscan.ts +44 -0
- package/src/pkg/commands/arseek.ts +17 -0
- package/src/pkg/commands/arset.ts +20 -0
- package/src/pkg/commands/bitcount.ts +30 -0
- package/src/pkg/commands/bitfield.ts +50 -0
- package/src/pkg/commands/bitop.ts +35 -0
- package/src/pkg/commands/bitpos.ts +15 -0
- package/src/pkg/commands/client_setinfo.ts +17 -0
- package/src/pkg/commands/command.ts +142 -0
- package/src/pkg/commands/copy.ts +22 -0
- package/src/pkg/commands/dbsize.ts +12 -0
- package/src/pkg/commands/decr.ts +12 -0
- package/src/pkg/commands/decrby.ts +12 -0
- package/src/pkg/commands/del.ts +12 -0
- package/src/pkg/commands/echo.ts +12 -0
- package/src/pkg/commands/eval.ts +18 -0
- package/src/pkg/commands/evalRo.ts +18 -0
- package/src/pkg/commands/evalsha.ts +18 -0
- package/src/pkg/commands/evalshaRo.ts +18 -0
- package/src/pkg/commands/exec.ts +23 -0
- package/src/pkg/commands/exists.ts +12 -0
- package/src/pkg/commands/expire.ts +13 -0
- package/src/pkg/commands/expireat.ts +16 -0
- package/src/pkg/commands/fcall.ts +15 -0
- package/src/pkg/commands/fcall_ro.ts +18 -0
- package/src/pkg/commands/flushall.ts +15 -0
- package/src/pkg/commands/flushdb.ts +15 -0
- package/src/pkg/commands/function_delete.ts +12 -0
- package/src/pkg/commands/function_flush.ts +12 -0
- package/src/pkg/commands/function_list.ts +77 -0
- package/src/pkg/commands/function_load.ts +31 -0
- package/src/pkg/commands/function_stats.ts +42 -0
- package/src/pkg/commands/geo_add.ts +54 -0
- package/src/pkg/commands/geo_dist.ts +19 -0
- package/src/pkg/commands/geo_hash.ts +23 -0
- package/src/pkg/commands/geo_pos.ts +39 -0
- package/src/pkg/commands/geo_search.ts +140 -0
- package/src/pkg/commands/geo_search_store.ts +69 -0
- package/src/pkg/commands/get.ts +15 -0
- package/src/pkg/commands/getbit.ts +12 -0
- package/src/pkg/commands/getdel.ts +15 -0
- package/src/pkg/commands/getex.ts +36 -0
- package/src/pkg/commands/getrange.ts +15 -0
- package/src/pkg/commands/getset.ts +15 -0
- package/src/pkg/commands/hdel.ts +12 -0
- package/src/pkg/commands/hexists.ts +12 -0
- package/src/pkg/commands/hexpire.ts +30 -0
- package/src/pkg/commands/hexpireat.ts +30 -0
- package/src/pkg/commands/hexpiretime.ts +13 -0
- package/src/pkg/commands/hget.ts +18 -0
- package/src/pkg/commands/hgetall.ts +44 -0
- package/src/pkg/commands/hgetdel.ts +30 -0
- package/src/pkg/commands/hgetex.ts +56 -0
- package/src/pkg/commands/hincrby.ts +15 -0
- package/src/pkg/commands/hincrbyfloat.ts +15 -0
- package/src/pkg/commands/hkeys.ts +12 -0
- package/src/pkg/commands/hlen.ts +12 -0
- package/src/pkg/commands/hmget.ts +53 -0
- package/src/pkg/commands/hmset.ts +14 -0
- package/src/pkg/commands/hpersist.ts +13 -0
- package/src/pkg/commands/hpexpire.ts +30 -0
- package/src/pkg/commands/hpexpireat.ts +30 -0
- package/src/pkg/commands/hpexpiretime.ts +13 -0
- package/src/pkg/commands/hpttl.ts +13 -0
- package/src/pkg/commands/hrandfield.ts +52 -0
- package/src/pkg/commands/hscan.ts +31 -0
- package/src/pkg/commands/hset.ts +15 -0
- package/src/pkg/commands/hsetex.ts +59 -0
- package/src/pkg/commands/hsetnx.ts +15 -0
- package/src/pkg/commands/hstrlen.ts +12 -0
- package/src/pkg/commands/httl.ts +13 -0
- package/src/pkg/commands/hvals.ts +12 -0
- package/src/pkg/commands/incr.ts +12 -0
- package/src/pkg/commands/incrby.ts +12 -0
- package/src/pkg/commands/incrbyfloat.ts +12 -0
- package/src/pkg/commands/json_arrappend.ts +18 -0
- package/src/pkg/commands/json_arrindex.ts +15 -0
- package/src/pkg/commands/json_arrinsert.ts +18 -0
- package/src/pkg/commands/json_arrlen.ts +15 -0
- package/src/pkg/commands/json_arrpop.ts +15 -0
- package/src/pkg/commands/json_arrtrim.ts +19 -0
- package/src/pkg/commands/json_clear.ts +12 -0
- package/src/pkg/commands/json_del.ts +12 -0
- package/src/pkg/commands/json_forget.ts +12 -0
- package/src/pkg/commands/json_get.ts +45 -0
- package/src/pkg/commands/json_merge.ts +18 -0
- package/src/pkg/commands/json_mget.ts +12 -0
- package/src/pkg/commands/json_mset.ts +27 -0
- package/src/pkg/commands/json_numincrby.ts +15 -0
- package/src/pkg/commands/json_nummultby.ts +15 -0
- package/src/pkg/commands/json_objkeys.ts +15 -0
- package/src/pkg/commands/json_objlen.ts +15 -0
- package/src/pkg/commands/json_resp.ts +11 -0
- package/src/pkg/commands/json_set.ts +35 -0
- package/src/pkg/commands/json_strappend.ts +15 -0
- package/src/pkg/commands/json_strlen.ts +15 -0
- package/src/pkg/commands/json_toggle.ts +12 -0
- package/src/pkg/commands/json_type.ts +12 -0
- package/src/pkg/commands/keys.ts +12 -0
- package/src/pkg/commands/lindex.ts +11 -0
- package/src/pkg/commands/linsert.ts +10 -0
- package/src/pkg/commands/llen.ts +12 -0
- package/src/pkg/commands/lmove.ts +20 -0
- package/src/pkg/commands/lmpop.ts +19 -0
- package/src/pkg/commands/lpop.ts +18 -0
- package/src/pkg/commands/lpos.ts +26 -0
- package/src/pkg/commands/lpush.ts +12 -0
- package/src/pkg/commands/lpushx.ts +12 -0
- package/src/pkg/commands/lrange.ts +11 -0
- package/src/pkg/commands/lrem.ts +10 -0
- package/src/pkg/commands/lset.ts +8 -0
- package/src/pkg/commands/ltrim.ts +8 -0
- package/src/pkg/commands/mget.ts +15 -0
- package/src/pkg/commands/mod.ts +222 -0
- package/src/pkg/commands/mset.ts +12 -0
- package/src/pkg/commands/msetnx.ts +12 -0
- package/src/pkg/commands/persist.ts +12 -0
- package/src/pkg/commands/pexpire.ts +16 -0
- package/src/pkg/commands/pexpireat.ts +16 -0
- package/src/pkg/commands/pfadd.ts +11 -0
- package/src/pkg/commands/pfcount.ts +11 -0
- package/src/pkg/commands/pfmerge.ts +11 -0
- package/src/pkg/commands/ping.ts +15 -0
- package/src/pkg/commands/psetex.ts +14 -0
- package/src/pkg/commands/psubscribe.ts +26 -0
- package/src/pkg/commands/pttl.ts +12 -0
- package/src/pkg/commands/publish.ts +12 -0
- package/src/pkg/commands/randomkey.ts +12 -0
- package/src/pkg/commands/rename.ts +12 -0
- package/src/pkg/commands/renamenx.ts +12 -0
- package/src/pkg/commands/rpop.ts +21 -0
- package/src/pkg/commands/rpush.ts +12 -0
- package/src/pkg/commands/rpushx.ts +12 -0
- package/src/pkg/commands/sadd.ts +15 -0
- package/src/pkg/commands/scan.ts +63 -0
- package/src/pkg/commands/scard.ts +11 -0
- package/src/pkg/commands/script_exists.ts +15 -0
- package/src/pkg/commands/script_flush.ts +22 -0
- package/src/pkg/commands/script_load.ts +12 -0
- package/src/pkg/commands/sdiff.ts +11 -0
- package/src/pkg/commands/sdiffstore.ts +14 -0
- package/src/pkg/commands/search/command-builder.ts +162 -0
- package/src/pkg/commands/search/index.ts +4 -0
- package/src/pkg/commands/search/schema-builder.ts +320 -0
- package/src/pkg/commands/search/search.ts +218 -0
- package/src/pkg/commands/search/types.ts +1029 -0
- package/src/pkg/commands/search/utils.ts +275 -0
- package/src/pkg/commands/set.ts +52 -0
- package/src/pkg/commands/setbit.ts +15 -0
- package/src/pkg/commands/setex.ts +11 -0
- package/src/pkg/commands/setnx.ts +11 -0
- package/src/pkg/commands/setrange.ts +15 -0
- package/src/pkg/commands/sinter.ts +11 -0
- package/src/pkg/commands/sintercard.ts +19 -0
- package/src/pkg/commands/sinterstore.ts +14 -0
- package/src/pkg/commands/sismember.ts +11 -0
- package/src/pkg/commands/smembers.ts +12 -0
- package/src/pkg/commands/smismember.ts +17 -0
- package/src/pkg/commands/smove.ts +14 -0
- package/src/pkg/commands/spop.ts +18 -0
- package/src/pkg/commands/srandmember.ts +18 -0
- package/src/pkg/commands/srem.ts +11 -0
- package/src/pkg/commands/sscan.ts +31 -0
- package/src/pkg/commands/strlen.ts +12 -0
- package/src/pkg/commands/subscribe.ts +254 -0
- package/src/pkg/commands/sunion.ts +12 -0
- package/src/pkg/commands/sunionstore.ts +15 -0
- package/src/pkg/commands/time.ts +10 -0
- package/src/pkg/commands/touch.ts +12 -0
- package/src/pkg/commands/ttl.ts +12 -0
- package/src/pkg/commands/type.ts +13 -0
- package/src/pkg/commands/types.ts +201 -0
- package/src/pkg/commands/unlink.ts +12 -0
- package/src/pkg/commands/vector/index.ts +11 -0
- package/src/pkg/commands/vector/types.ts +63 -0
- package/src/pkg/commands/vector/utils.ts +67 -0
- package/src/pkg/commands/vector/vector.ts +131 -0
- package/src/pkg/commands/vector_add.ts +18 -0
- package/src/pkg/commands/vector_count.ts +11 -0
- package/src/pkg/commands/vector_create.ts +28 -0
- package/src/pkg/commands/vector_del.ts +13 -0
- package/src/pkg/commands/vector_drop.ts +13 -0
- package/src/pkg/commands/vector_get.ts +18 -0
- package/src/pkg/commands/vector_info.ts +25 -0
- package/src/pkg/commands/vector_query.ts +24 -0
- package/src/pkg/commands/xack.ts +16 -0
- package/src/pkg/commands/xackdel.ts +21 -0
- package/src/pkg/commands/xadd.ts +70 -0
- package/src/pkg/commands/xautoclaim.ts +31 -0
- package/src/pkg/commands/xclaim.ts +56 -0
- package/src/pkg/commands/xdel.ts +16 -0
- package/src/pkg/commands/xdelex.ts +25 -0
- package/src/pkg/commands/xgroup.ts +101 -0
- package/src/pkg/commands/xinfo.ts +28 -0
- package/src/pkg/commands/xlen.ts +12 -0
- package/src/pkg/commands/xpending.ts +44 -0
- package/src/pkg/commands/xrange.ts +49 -0
- package/src/pkg/commands/xread.ts +78 -0
- package/src/pkg/commands/xreadgroup.ts +74 -0
- package/src/pkg/commands/xrevrange.ts +48 -0
- package/src/pkg/commands/xtrim.ts +25 -0
- package/src/pkg/commands/zadd.ts +54 -0
- package/src/pkg/commands/zcard.ts +12 -0
- package/src/pkg/commands/zcount.ts +14 -0
- package/src/pkg/commands/zdiffstore.ts +15 -0
- package/src/pkg/commands/zincrby.ts +14 -0
- package/src/pkg/commands/zinterstore.ts +51 -0
- package/src/pkg/commands/zlexcount.ts +11 -0
- package/src/pkg/commands/zmscore.ts +16 -0
- package/src/pkg/commands/zpopmax.ts +18 -0
- package/src/pkg/commands/zpopmin.ts +18 -0
- package/src/pkg/commands/zrange.ts +72 -0
- package/src/pkg/commands/zrank.ts +14 -0
- package/src/pkg/commands/zrem.ts +11 -0
- package/src/pkg/commands/zremrangebylex.ts +11 -0
- package/src/pkg/commands/zremrangebyrank.ts +14 -0
- package/src/pkg/commands/zremrangebyscore.ts +18 -0
- package/src/pkg/commands/zrevrank.ts +14 -0
- package/src/pkg/commands/zscan.ts +31 -0
- package/src/pkg/commands/zscore.ts +15 -0
- package/src/pkg/commands/zunion.ts +54 -0
- package/src/pkg/commands/zunionstore.ts +52 -0
- package/src/pkg/error.ts +28 -0
- package/src/pkg/http.ts +458 -0
- package/src/pkg/index.ts +1 -0
- package/src/pkg/pipeline.ts +2041 -0
- package/src/pkg/redis.ts +2130 -0
- package/src/pkg/script.ts +100 -0
- package/src/pkg/scriptRo.ts +98 -0
- package/src/pkg/types.ts +35 -0
- package/src/pkg/util.ts +115 -0
- package/src/platforms/cloudflare.ts +162 -0
- package/src/platforms/fastly.ts +105 -0
- package/src/platforms/nodejs.ts +231 -0
- package/src/version.ts +1 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SMOVE
|
|
3
|
+
description: Move a member from one set to another
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="source" type="string" required>
|
|
9
|
+
The key of the set to move the member from.
|
|
10
|
+
</ParamField>
|
|
11
|
+
<ParamField body="destination" type="string" required>
|
|
12
|
+
The key of the set to move the member to.
|
|
13
|
+
</ParamField>
|
|
14
|
+
|
|
15
|
+
<ParamField body="member" type="TMember">
|
|
16
|
+
The members to move
|
|
17
|
+
</ParamField>
|
|
18
|
+
|
|
19
|
+
## Response
|
|
20
|
+
|
|
21
|
+
<ResponseField type="0 | 1" required>
|
|
22
|
+
`1` if the member was moved, `0` if not.
|
|
23
|
+
</ResponseField>
|
|
24
|
+
|
|
25
|
+
<RequestExample>
|
|
26
|
+
```ts Example
|
|
27
|
+
await redis.sadd("original", "a", "b", "c");
|
|
28
|
+
const moved = await redis.smove("original", "destination", "a");
|
|
29
|
+
// moved: 1
|
|
30
|
+
// original: ["b", "c"]
|
|
31
|
+
// destination: ["a"]
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
</RequestExample>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SPOP
|
|
3
|
+
description: Removes and returns one or more random members from a set.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key of the set.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="count" type="number" default={1}>
|
|
13
|
+
How many members to remove and return.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Response
|
|
18
|
+
|
|
19
|
+
<ResponseField type="TMember | TMember[]" required>
|
|
20
|
+
The popped member.
|
|
21
|
+
If `count` is specified, an array of members is returned.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
await redis.sadd("set", "a", "b", "c");
|
|
27
|
+
const popped = await redis.spop("set");
|
|
28
|
+
console.log(popped); // "a"
|
|
29
|
+
```
|
|
30
|
+
```ts With Count
|
|
31
|
+
await redis.sadd("set", "a", "b", "c");
|
|
32
|
+
const popped = await redis.spop("set", 2);
|
|
33
|
+
console.log(popped); // ["a", "b"]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</RequestExample>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SRANDMEMBER
|
|
3
|
+
description: Returns one or more random members from a set.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key of the set.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="count" type="number" default={1}>
|
|
13
|
+
How many members to return.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
## Response
|
|
18
|
+
|
|
19
|
+
<ResponseField type="TMember | TMember[]" required>
|
|
20
|
+
The random member.
|
|
21
|
+
If `count` is specified, an array of members is returned.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
await redis.sadd("set", "a", "b", "c");
|
|
27
|
+
const member = await redis.srandmember("set");
|
|
28
|
+
console.log(member); // "a"
|
|
29
|
+
```
|
|
30
|
+
```ts With Count
|
|
31
|
+
await redis.sadd("set", "a", "b", "c");
|
|
32
|
+
const members = await redis.srandmember("set", 2);
|
|
33
|
+
console.log(members); // ["a", "b"]
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
</RequestExample>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SREM
|
|
3
|
+
description: Remove one or more members from a set
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key of the set to remove the member from.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="members" type="...TMember[]">
|
|
13
|
+
One or more members to remove from the set.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
## Response
|
|
17
|
+
|
|
18
|
+
<ResponseField type="integer" required>
|
|
19
|
+
How many members were removed
|
|
20
|
+
</ResponseField>
|
|
21
|
+
|
|
22
|
+
<RequestExample>
|
|
23
|
+
```ts Example
|
|
24
|
+
await redis.sadd("set", "a", "b", "c");
|
|
25
|
+
const removed = await redis.srem("set", "a", "b", "d");
|
|
26
|
+
console.log(removed); // 2
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
</RequestExample>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SSCAN
|
|
3
|
+
description: Scan a set
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key of the set.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="cursor" type="number">
|
|
13
|
+
The cursor, use `0` in the beginning and then use the returned cursor for subsequent calls.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
<ParamField body="options" type="Object">
|
|
17
|
+
<ParamField body="match" type="string">
|
|
18
|
+
Glob-style pattern to filter by members.
|
|
19
|
+
</ParamField>
|
|
20
|
+
<ParamField body="count" type="number">
|
|
21
|
+
Number of members to return per call.
|
|
22
|
+
</ParamField>
|
|
23
|
+
</ParamField>
|
|
24
|
+
|
|
25
|
+
## Response
|
|
26
|
+
|
|
27
|
+
<ResponseField type="[number, TMember[]]" required>
|
|
28
|
+
The new cursor and the members.
|
|
29
|
+
If the new cursor is `0` the iteration is complete.
|
|
30
|
+
</ResponseField>
|
|
31
|
+
|
|
32
|
+
<RequestExample>
|
|
33
|
+
```ts Example
|
|
34
|
+
await redis.sadd("key", "a", "ab","b", "c");
|
|
35
|
+
const [newCursor, fields] = await redis.sscan("key", 0, { match: "a*"});
|
|
36
|
+
console.log(newCursor); // likely `0` since this is a very small set
|
|
37
|
+
console.log(fields); // ["a", "ab"]
|
|
38
|
+
```
|
|
39
|
+
</RequestExample>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SUNION
|
|
3
|
+
description: Return the union between sets
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="keys" type="...string[]" required>
|
|
9
|
+
The keys of the sets to perform the union operation on.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
## Response
|
|
14
|
+
|
|
15
|
+
<ResponseField type="TValue[]" required>
|
|
16
|
+
The members of the resulting set.
|
|
17
|
+
</ResponseField>
|
|
18
|
+
|
|
19
|
+
<RequestExample>
|
|
20
|
+
```ts Example
|
|
21
|
+
await redis.sadd("set1", "a", "b", "c");
|
|
22
|
+
await redis.sadd("set2", "c", "d", "e");
|
|
23
|
+
const union = await redis.sunion("set1", "set2");
|
|
24
|
+
console.log(union); // ["a", "b", "c", "d", "e"]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
</RequestExample>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: SUNIONSTORE
|
|
3
|
+
description: Return the union between sets and store the resulting set in a key
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
<ParamField body="destination" type="string" required>
|
|
11
|
+
The key of the set to store the resulting set in.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
<ParamField body="keys" type="...string[]" required>
|
|
16
|
+
The keys of the sets to perform the union operation on.
|
|
17
|
+
</ParamField>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
## Response
|
|
21
|
+
|
|
22
|
+
<ResponseField type="TValue[]" required>
|
|
23
|
+
The members of the resulting set.
|
|
24
|
+
</ResponseField>
|
|
25
|
+
|
|
26
|
+
<RequestExample>
|
|
27
|
+
```ts Example
|
|
28
|
+
await redis.sadd("set1", "a", "b", "c");
|
|
29
|
+
await redis.sadd("set2", "c", "d", "e");
|
|
30
|
+
await redis.sunionstore("destination", "set1", "set2");
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
</RequestExample>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: XACK
|
|
3
|
+
description: Removes one or multiple messages from the pending entries list of a stream consumer group.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key of the stream.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="group" type="string" required>
|
|
13
|
+
The consumer group name.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
<ParamField body="id" type="string | string[]" required>
|
|
17
|
+
The ID(s) of the message(s) to acknowledge. Can be a single ID or an array of IDs.
|
|
18
|
+
</ParamField>
|
|
19
|
+
|
|
20
|
+
## Response
|
|
21
|
+
|
|
22
|
+
<ResponseField type="number">
|
|
23
|
+
The number of messages successfully acknowledged.
|
|
24
|
+
</ResponseField>
|
|
25
|
+
|
|
26
|
+
<RequestExample>
|
|
27
|
+
```ts Single message
|
|
28
|
+
const result = await redis.xack("mystream", "mygroup", "1638360173533-0");
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```ts Multiple messages
|
|
32
|
+
const result = await redis.xack("mystream", "mygroup", [
|
|
33
|
+
"1638360173533-0",
|
|
34
|
+
"1638360173533-1"
|
|
35
|
+
]);
|
|
36
|
+
```
|
|
37
|
+
</RequestExample>
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: XACKDEL
|
|
3
|
+
description: Acknowledge and delete stream entries atomically.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
The `XACKDEL` command acknowledges and deletes stream entries atomically in a single operation. This is useful for consumer groups where you want to acknowledge message processing and remove the entries from the stream simultaneously.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The key of the stream.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="group" type="string" required>
|
|
15
|
+
The consumer group name.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="option" type="'KEEPREF' | 'keepref' | 'DELREF' | 'delref' | 'ACKED' | 'acked'">
|
|
19
|
+
Optional deletion behavior (case-insensitive). When provided, must come before the IDs:
|
|
20
|
+
- `KEEPREF`: Keep consumer group references
|
|
21
|
+
- `DELREF`: Delete consumer group references
|
|
22
|
+
- `ACKED`: Only acknowledge messages (don't delete)
|
|
23
|
+
|
|
24
|
+
If not provided, entries are acknowledged and deleted by default.
|
|
25
|
+
</ParamField>
|
|
26
|
+
|
|
27
|
+
<ParamField body="ids" type="...string[]" required>
|
|
28
|
+
One or more stream entry IDs to acknowledge and delete. When an option is provided, IDs must come after the option.
|
|
29
|
+
</ParamField>
|
|
30
|
+
|
|
31
|
+
## Response
|
|
32
|
+
|
|
33
|
+
<ResponseField type="any[]" required>
|
|
34
|
+
An array indicating the result for each ID in the same order as provided.
|
|
35
|
+
</ResponseField>
|
|
36
|
+
|
|
37
|
+
<RequestExample>
|
|
38
|
+
```ts Single Entry
|
|
39
|
+
// Acknowledge and delete a single entry
|
|
40
|
+
const result = await redis.xackdel("mystream", "mygroup", "1638360173533-0");
|
|
41
|
+
console.log(result); // Array of results for each ID
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```ts Multiple Entries
|
|
45
|
+
// Acknowledge and delete multiple entries
|
|
46
|
+
const result = await redis.xackdel(
|
|
47
|
+
"mystream",
|
|
48
|
+
"mygroup",
|
|
49
|
+
"1638360173533-0",
|
|
50
|
+
"1638360173533-1",
|
|
51
|
+
"1638360173533-2"
|
|
52
|
+
);
|
|
53
|
+
console.log(result); // Array of results for each ID
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```ts With KEEPREF Option
|
|
57
|
+
// Keep consumer group references when deleting entries
|
|
58
|
+
// Useful when you want to delete entries but maintain group tracking
|
|
59
|
+
const result = await redis.xackdel(
|
|
60
|
+
"mystream",
|
|
61
|
+
"mygroup",
|
|
62
|
+
"KEEPREF",
|
|
63
|
+
"1638360173533-0",
|
|
64
|
+
"1638360173533-1",
|
|
65
|
+
);
|
|
66
|
+
console.log(result); // Array of results for each ID
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
```ts With DELREF Option
|
|
70
|
+
// Delete consumer group references along with entries
|
|
71
|
+
// Useful for complete cleanup of processed messages
|
|
72
|
+
const result = await redis.xackdel(
|
|
73
|
+
"mystream",
|
|
74
|
+
"mygroup",
|
|
75
|
+
"DELREF",
|
|
76
|
+
"1638360173533-0",
|
|
77
|
+
"1638360173533-1",
|
|
78
|
+
);
|
|
79
|
+
console.log(result); // Array of results for each ID
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```ts With ACKED Option
|
|
83
|
+
// Only acknowledge messages without deleting them
|
|
84
|
+
// Useful when you want to mark as processed but keep for audit/debugging
|
|
85
|
+
const result = await redis.xackdel(
|
|
86
|
+
"mystream",
|
|
87
|
+
"mygroup",
|
|
88
|
+
"ACKED",
|
|
89
|
+
"1638360173533-0",
|
|
90
|
+
);
|
|
91
|
+
console.log(result); // Array of results for each ID
|
|
92
|
+
// Entry remains in stream but is acknowledged
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```ts Consumer Group Processing
|
|
96
|
+
// Create a consumer group
|
|
97
|
+
await redis.xgroup("CREATE", "orders", "processors", "0", "MKSTREAM");
|
|
98
|
+
|
|
99
|
+
// Add some orders to the stream
|
|
100
|
+
await redis.xadd("orders", "*", { order_id: "123", status: "pending" });
|
|
101
|
+
await redis.xadd("orders", "*", { order_id: "124", status: "pending" });
|
|
102
|
+
|
|
103
|
+
// Read messages as a consumer
|
|
104
|
+
const messages = await redis.xreadgroup(
|
|
105
|
+
"GROUP", "processors", "consumer1",
|
|
106
|
+
"COUNT", 2,
|
|
107
|
+
"STREAMS", "orders", ">"
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Process messages and acknowledge + delete them
|
|
111
|
+
for (const [stream, entries] of messages) {
|
|
112
|
+
for (const [id, fields] of entries) {
|
|
113
|
+
// Process the order...
|
|
114
|
+
console.log(`Processing order ${fields.order_id}`);
|
|
115
|
+
|
|
116
|
+
// Acknowledge and delete the entry (default behavior)
|
|
117
|
+
await redis.xackdel("orders", "processors", id);
|
|
118
|
+
|
|
119
|
+
// Or use DELREF for complete cleanup
|
|
120
|
+
// await redis.xackdel("orders", "processors", "DELREF", id);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```ts Batch Processing
|
|
126
|
+
// Read pending messages
|
|
127
|
+
const pending = await redis.xreadgroup(
|
|
128
|
+
"GROUP", "tasks", "worker1",
|
|
129
|
+
"COUNT", 10,
|
|
130
|
+
"STREAMS", "task-queue", ">"
|
|
131
|
+
);
|
|
132
|
+
|
|
133
|
+
if (pending && pending.length > 0) {
|
|
134
|
+
const [stream, entries] = pending[0];
|
|
135
|
+
const processedIds: string[] = [];
|
|
136
|
+
|
|
137
|
+
// Process each task
|
|
138
|
+
for (const [id, fields] of entries) {
|
|
139
|
+
try {
|
|
140
|
+
// Process task...
|
|
141
|
+
console.log(`Processing task ${id}`);
|
|
142
|
+
processedIds.push(id);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
console.error(`Failed to process ${id}:`, error);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Acknowledge and delete all successfully processed tasks
|
|
149
|
+
// Using DELREF to completely remove references
|
|
150
|
+
if (processedIds.length > 0) {
|
|
151
|
+
const result = await redis.xackdel("task-queue", "tasks", "DELREF", ...processedIds);
|
|
152
|
+
console.log(`Results: ${result}`); // Array of results for each ID
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```ts Audit Mode with ACKED
|
|
158
|
+
// Process messages but keep them for audit/debugging purposes
|
|
159
|
+
const messages = await redis.xreadgroup(
|
|
160
|
+
"GROUP", "audit", "auditor1",
|
|
161
|
+
"COUNT", 5,
|
|
162
|
+
"STREAMS", "events", ">"
|
|
163
|
+
);
|
|
164
|
+
|
|
165
|
+
for (const [stream, entries] of messages) {
|
|
166
|
+
const entryIds = entries.map(([id]) => id);
|
|
167
|
+
|
|
168
|
+
// Process and acknowledge but don't delete
|
|
169
|
+
for (const [id, fields] of entries) {
|
|
170
|
+
// Audit the event...
|
|
171
|
+
console.log(`Auditing event ${JSON.stringify(fields)}`);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// Acknowledge without deleting (keep for audit trail)
|
|
175
|
+
const result = await redis.xackdel("events", "audit", "ACKED", ...entryIds);
|
|
176
|
+
console.log(`Acknowledged ${result.length} events (kept in stream)`);
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
</RequestExample>
|
|
180
|
+
|
|
181
|
+
## Use Cases
|
|
182
|
+
|
|
183
|
+
- **Message Queue Cleanup**: Process messages and remove them from the stream in one operation
|
|
184
|
+
- **Event Processing**: Acknowledge event handling and clean up the stream
|
|
185
|
+
- **Task Queue Management**: Complete tasks and remove them atomically
|
|
186
|
+
- **Memory Optimization**: Reduce stream memory usage by removing processed entries
|
|
187
|
+
|
|
188
|
+
## Comparison with XACK + XDEL
|
|
189
|
+
|
|
190
|
+
Traditional approach (two operations):
|
|
191
|
+
```ts
|
|
192
|
+
// Acknowledge the message
|
|
193
|
+
await redis.xack("mystream", "mygroup", "123-0");
|
|
194
|
+
// Then delete it
|
|
195
|
+
await redis.xdel("mystream", "123-0");
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
With XACKDEL (single atomic operation):
|
|
199
|
+
```ts
|
|
200
|
+
// Acknowledge and delete in one operation (default)
|
|
201
|
+
await redis.xackdel("mystream", "mygroup", "123-0");
|
|
202
|
+
|
|
203
|
+
// With options for fine-grained control
|
|
204
|
+
await redis.xackdel("mystream", "mygroup", "DELREF", "123-0"); // Complete cleanup
|
|
205
|
+
await redis.xackdel("mystream", "mygroup", "ACKED", "123-0"); // Acknowledge only
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
<Note>
|
|
209
|
+
This command is available in Redis 8.2.0 and later. It combines XACK and XDEL into a single atomic operation, which is more efficient and ensures consistency.
|
|
210
|
+
</Note>
|
|
211
|
+
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: XADD
|
|
3
|
+
description: Appends one or more new entries to a stream.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The key to of the stream.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="id" type="string | *" required>
|
|
13
|
+
The stream entry ID. Supports multiple formats:
|
|
14
|
+
- `*`: Fully automatic ID generation (both timestamp and sequence)
|
|
15
|
+
- `<ms>-<seq>`: Explicit ID (e.g., "1526919030474-55")
|
|
16
|
+
- `<ms>-*`: Auto-generate sequence number for the given millisecond timestamp (Redis 8+)
|
|
17
|
+
</ParamField>
|
|
18
|
+
|
|
19
|
+
<ParamField body="entries" type="Record<string, unknown>" required>
|
|
20
|
+
Key-value data to be appended to the stream.
|
|
21
|
+
</ParamField>
|
|
22
|
+
|
|
23
|
+
<ParamField body="options" type="object">
|
|
24
|
+
<Expandable title="properties">
|
|
25
|
+
<ParamField body="nomkStream" type="boolean">
|
|
26
|
+
Prevent creating the stream if it does not exist.
|
|
27
|
+
</ParamField>
|
|
28
|
+
|
|
29
|
+
<ParamField body="trim" type="object">
|
|
30
|
+
Trim options for the stream.
|
|
31
|
+
|
|
32
|
+
<Expandable title="trim">
|
|
33
|
+
<ParamField body="type" type="'MAXLEN' | 'MINID'" required>
|
|
34
|
+
The trim strategy:
|
|
35
|
+
- `MAXLEN`: Trim based on the maximum number of entries
|
|
36
|
+
- `MINID`: Trim based on the minimum ID
|
|
37
|
+
</ParamField>
|
|
38
|
+
|
|
39
|
+
<ParamField body="threshold" type="number | string" required>
|
|
40
|
+
The threshold value for trimming:
|
|
41
|
+
- For `MAXLEN`: The maximum number of entries to keep (number)
|
|
42
|
+
- For `MINID`: The minimum ID to keep (string)
|
|
43
|
+
</ParamField>
|
|
44
|
+
|
|
45
|
+
<ParamField body="comparison" type="'~' | '='" required>
|
|
46
|
+
The comparison operator:
|
|
47
|
+
- `~`: Approximate trimming (more efficient)
|
|
48
|
+
- `=`: Exact trimming
|
|
49
|
+
</ParamField>
|
|
50
|
+
|
|
51
|
+
<ParamField body="limit" type="number">
|
|
52
|
+
Limit how many entries will be trimmed at most
|
|
53
|
+
</ParamField>
|
|
54
|
+
</Expandable>
|
|
55
|
+
</ParamField>
|
|
56
|
+
</Expandable>
|
|
57
|
+
</ParamField>
|
|
58
|
+
|
|
59
|
+
## Response
|
|
60
|
+
|
|
61
|
+
<ResponseField type="string">The ID of the newly added entry.</ResponseField>
|
|
62
|
+
|
|
63
|
+
<RequestExample>
|
|
64
|
+
```ts Basic Example
|
|
65
|
+
const result = await redis.xadd("mystream", "*", { name: "John Doe", age: 30 });
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```ts With Custom ID
|
|
69
|
+
const result = await redis.xadd("mystream", "1634567890123-0", { temperature: 25.5, humidity: 60 });
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```ts Trimming with MAXLEN
|
|
73
|
+
const result = await redis.xadd("mystream", "*", { event: "user_login", user_id: "12345" }, {
|
|
74
|
+
trim: {
|
|
75
|
+
type: "MAXLEN",
|
|
76
|
+
threshold: 1000,
|
|
77
|
+
comparison: "="
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
```ts Prevent Stream Creation
|
|
83
|
+
const result = await redis.xadd("existing_stream", "*", { data: "value" }, {
|
|
84
|
+
nomkStream: true
|
|
85
|
+
});
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```ts Trimming with MINID
|
|
89
|
+
const result = await redis.xadd("mystream", "*", { action: "purchase", amount: 99.99 }, {
|
|
90
|
+
trim: {
|
|
91
|
+
type: "MINID",
|
|
92
|
+
threshold: "1634567890000-0",
|
|
93
|
+
comparison: "="
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
```ts Auto Sequence Number (Redis 8+)
|
|
99
|
+
// Specify millisecond timestamp, let Redis generate sequence number
|
|
100
|
+
const ms = Date.now();
|
|
101
|
+
const id1 = await redis.xadd("mystream", `${ms}-*`, { event: "login", user: "john" });
|
|
102
|
+
console.log(id1); // e.g., "1769347235123-0"
|
|
103
|
+
|
|
104
|
+
// Multiple entries with same ms but different sequence numbers
|
|
105
|
+
const id2 = await redis.xadd("mystream", `${ms}-*`, { event: "logout", user: "john" });
|
|
106
|
+
console.log(id2); // e.g., "1769347235123-1"
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
```ts Precise Timestamp Control
|
|
110
|
+
// Use auto sequence for precise timestamp control
|
|
111
|
+
const timestamp = 1634567890123;
|
|
112
|
+
const result = await redis.xadd("events", `${timestamp}-*`, {
|
|
113
|
+
type: "payment",
|
|
114
|
+
amount: 100.00,
|
|
115
|
+
currency: "USD"
|
|
116
|
+
});
|
|
117
|
+
// Redis generates the sequence number automatically
|
|
118
|
+
```
|
|
119
|
+
</RequestExample>
|
|
120
|
+
|
|
121
|
+
## ID Format Details
|
|
122
|
+
|
|
123
|
+
### Automatic ID (`*`)
|
|
124
|
+
Fully automatic - Redis generates both the millisecond timestamp and sequence number.
|
|
125
|
+
|
|
126
|
+
### Explicit ID (`<ms>-<seq>`)
|
|
127
|
+
You provide both the millisecond timestamp and sequence number. Example: `"1526919030474-55"`
|
|
128
|
+
|
|
129
|
+
### Auto Sequence (`<ms>-*`) - Redis 8+
|
|
130
|
+
You provide the millisecond timestamp, Redis automatically generates the sequence number. This is useful when you need precise control over the timestamp but want Redis to handle sequence numbering.
|
|
131
|
+
|
|
132
|
+
**Benefits of Auto Sequence:**
|
|
133
|
+
- Precise timestamp control for time-sensitive data
|
|
134
|
+
- Automatic sequence management prevents conflicts
|
|
135
|
+
- Multiple entries can share the same millisecond with different sequences
|
|
136
|
+
- Ideal for batch operations with consistent timestamps
|
|
137
|
+
|