@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
package/cloudflare.mjs
CHANGED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Redis TypeScript SDK Advanced Usage
|
|
3
|
+
sidebarTitle: Advanced
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Disable automatic serialization
|
|
7
|
+
|
|
8
|
+
Your data is (de)serialized as `json` by default. This works for most use cases
|
|
9
|
+
but you can disable it if you want:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
const redis = new Redis({
|
|
13
|
+
// ...
|
|
14
|
+
automaticDeserialization: false,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
// or
|
|
18
|
+
const redis = Redis.fromEnv({
|
|
19
|
+
automaticDeserialization: false,
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
This probably breaks quite a few types, but it's a first step in that direction.
|
|
24
|
+
Please report bugs and broken types
|
|
25
|
+
[here](https://github.com/upstash/upstash-redis/issues/49).
|
|
26
|
+
|
|
27
|
+
## Keep-Alive
|
|
28
|
+
|
|
29
|
+
`@upstash/redis` optimizes performance by reusing connections wherever possible, reducing latency.
|
|
30
|
+
This is achieved by keeping the client in memory instead of reinitializing it with each new function invocation.
|
|
31
|
+
As a result, when a hot lambda function receives a new request, it uses the already initialized client, allowing for the reuse of existing connections to Upstash.
|
|
32
|
+
|
|
33
|
+
<Tip>This functionality is enabled by default.</Tip>
|
|
34
|
+
|
|
35
|
+
## Request Timeout
|
|
36
|
+
|
|
37
|
+
You can configure the SDK so that it will throw an error if the request takes longer than a specified time.
|
|
38
|
+
|
|
39
|
+
You can achieve this using the signal parameter like this:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
const redis = new Redis({
|
|
43
|
+
url: "<UPSTASH_REDIS_REST_URL>",
|
|
44
|
+
token: "<UPSTASH_REDIS_REST_TOKEN>",
|
|
45
|
+
// set a timeout of 1 second
|
|
46
|
+
signal: () => AbortSignal.timeout(1000),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
await redis.get( ... )
|
|
51
|
+
} catch (error) {
|
|
52
|
+
if (error.name === "TimeoutError") {
|
|
53
|
+
console.error("Request timed out");
|
|
54
|
+
} else {
|
|
55
|
+
console.error("An error occurred:", error);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Telemetry
|
|
61
|
+
|
|
62
|
+
This library sends anonymous telemetry data to help us improve your experience.
|
|
63
|
+
We collect the following:
|
|
64
|
+
|
|
65
|
+
- SDK version
|
|
66
|
+
- Platform (Deno, Cloudflare, Vercel)
|
|
67
|
+
- Runtime version (node@18.x)
|
|
68
|
+
|
|
69
|
+
You can opt out by setting the `UPSTASH_DISABLE_TELEMETRY` environment variable
|
|
70
|
+
to any truthy value.
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
UPSTASH_DISABLE_TELEMETRY=1
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Alternatively, you can pass `enableTelemetry: false` when initializing the Redis client:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const redis = new Redis({
|
|
80
|
+
// ...,
|
|
81
|
+
enableTelemetry: false,
|
|
82
|
+
});
|
|
83
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARCOUNT
|
|
3
|
+
description: Count the occupied slots in an array.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
For sparse arrays, this differs from [ARLEN](./arlen), which returns the highest occupied index plus one.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
## Response
|
|
15
|
+
|
|
16
|
+
<ResponseField type="number" required>
|
|
17
|
+
The number of slots containing values, or zero for a missing key.
|
|
18
|
+
</ResponseField>
|
|
19
|
+
|
|
20
|
+
<RequestExample>
|
|
21
|
+
```ts Example
|
|
22
|
+
await redis.arset("readings", 1000, "sample");
|
|
23
|
+
console.log(await redis.arcount("readings")); // 1
|
|
24
|
+
console.log(await redis.arlen("readings")); // "1001"
|
|
25
|
+
```
|
|
26
|
+
</RequestExample>
|
|
27
|
+
|
|
28
|
+
See the [server command reference](/redis/commands/array/arcount) for protocol details.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARDEL
|
|
3
|
+
description: Delete array values without shifting later indexes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The array key.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="indexes" type="...(number | string)[]" required>
|
|
13
|
+
One or more indexes, passed as separate arguments.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
## Response
|
|
17
|
+
|
|
18
|
+
<ResponseField type="number" required>
|
|
19
|
+
The number of occupied slots removed. Empty slots and repeated indexes do not increase the count.
|
|
20
|
+
</ResponseField>
|
|
21
|
+
|
|
22
|
+
<RequestExample>
|
|
23
|
+
```ts Example
|
|
24
|
+
await redis.arset("readings", 0, "a", "b", "c");
|
|
25
|
+
console.log(await redis.ardel("readings", 1, 1, 99)); // 1
|
|
26
|
+
console.log(await redis.argetrange("readings", 0, 2)); // ["a", null, "c"]
|
|
27
|
+
```
|
|
28
|
+
</RequestExample>
|
|
29
|
+
|
|
30
|
+
See the [server command reference](/redis/commands/array/ardel) for protocol details.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARDELRANGE
|
|
3
|
+
description: Delete occupied slots in one or more inclusive ranges.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Deleting values leaves holes and does not shift later values.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="ranges" type="...[number | string, number | string][]" required>
|
|
15
|
+
One or more inclusive start-end pairs, passed as separate arguments.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
## Response
|
|
19
|
+
|
|
20
|
+
<ResponseField type="number" required>
|
|
21
|
+
The number of values removed across the ranges. Overlapping ranges do not count a value twice.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
await redis.arset("readings", 0, "a", "b", "c", "d", "e");
|
|
27
|
+
console.log(await redis.ardelrange("readings", [0, 1], [4, 4])); // 3
|
|
28
|
+
console.log(await redis.arcount("readings")); // 2
|
|
29
|
+
```
|
|
30
|
+
</RequestExample>
|
|
31
|
+
|
|
32
|
+
See the [server command reference](/redis/commands/array/ardelrange) for protocol details.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARGET
|
|
3
|
+
description: Read the value at an array index.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The array key.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="index" type="number | string" required>
|
|
13
|
+
The zero-based index to access.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
## Response
|
|
17
|
+
|
|
18
|
+
<ResponseField type="TData | null" required>
|
|
19
|
+
The stored value, or `null` (TypeScript) / `None` (Python) for an empty slot or missing key.
|
|
20
|
+
</ResponseField>
|
|
21
|
+
|
|
22
|
+
Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
await redis.arset("readings", 7, { temperature: 21.5 });
|
|
27
|
+
const reading = await redis.arget<{ temperature: number }>("readings", 7);
|
|
28
|
+
console.log(reading); // { temperature: 21.5 }
|
|
29
|
+
console.log(await redis.arget("readings", 6)); // null
|
|
30
|
+
```
|
|
31
|
+
</RequestExample>
|
|
32
|
+
|
|
33
|
+
See the [server command reference](/redis/commands/array/arget) for protocol details.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARGETRANGE
|
|
3
|
+
description: Read every slot in an inclusive array range.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
A start greater than the end returns values in reverse index order. The server rejects ranges containing more than 1,000,000 indexes. Use [ARSCAN](./arscan) for sparse ranges.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="start" type="number | string" required>
|
|
15
|
+
The first index of the inclusive range.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="end" type="number | string" required>
|
|
19
|
+
The last index of the inclusive range.
|
|
20
|
+
</ParamField>
|
|
21
|
+
|
|
22
|
+
## Response
|
|
23
|
+
|
|
24
|
+
<ResponseField type="(TData | null)[]" required>
|
|
25
|
+
One value per index in the range, including `null` (TypeScript) / `None` (Python) for empty slots.
|
|
26
|
+
</ResponseField>
|
|
27
|
+
|
|
28
|
+
Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
|
|
29
|
+
|
|
30
|
+
<RequestExample>
|
|
31
|
+
```ts Example
|
|
32
|
+
await redis.armset("readings", { 0: "a", 2: "c" });
|
|
33
|
+
console.log(await redis.argetrange("readings", 0, 3)); // ["a", null, "c", null]
|
|
34
|
+
console.log(await redis.argetrange("readings", 2, 0)); // ["c", null, "a"]
|
|
35
|
+
```
|
|
36
|
+
</RequestExample>
|
|
37
|
+
|
|
38
|
+
See the [server command reference](/redis/commands/array/argetrange) for protocol details.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARGREP
|
|
3
|
+
description: Search array values using one or more predicates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Provide at least one predicate and at most 250. Regular expressions are limited to 2048 bytes and do not support backreferences.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="start" type="number | string" required>
|
|
15
|
+
The first index to search. Use `"-"` for the lowest possible index.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="end" type="number | string" required>
|
|
19
|
+
The last index to search. Use `"+"` for the highest possible index.
|
|
20
|
+
</ParamField>
|
|
21
|
+
|
|
22
|
+
<ParamField body="options" type="Object" required>
|
|
23
|
+
<ParamField body="predicates" type="ArGrepPredicate[]" required>
|
|
24
|
+
One to 250 predicates. Each is `{ exact: string }`, `{ match: string }`, `{ glob: string }`, or `{ re: string }` for equality, substring, glob, or regular-expression matching.
|
|
25
|
+
</ParamField>
|
|
26
|
+
|
|
27
|
+
<ParamField body="combine" type="'AND' | 'OR' | 'and' | 'or'">
|
|
28
|
+
How to combine predicates. Defaults to OR.
|
|
29
|
+
</ParamField>
|
|
30
|
+
|
|
31
|
+
<ParamField body="noCase" type="boolean">
|
|
32
|
+
Match case-insensitively. Defaults to false.
|
|
33
|
+
</ParamField>
|
|
34
|
+
|
|
35
|
+
<ParamField body="withValues" type="boolean">
|
|
36
|
+
Return index-value pairs instead of indexes. Defaults to false.
|
|
37
|
+
</ParamField>
|
|
38
|
+
|
|
39
|
+
<ParamField body="limit" type="number">
|
|
40
|
+
Maximum number of matches. If provided, it must be greater than zero.
|
|
41
|
+
</ParamField>
|
|
42
|
+
</ParamField>
|
|
43
|
+
|
|
44
|
+
## Response
|
|
45
|
+
|
|
46
|
+
<ResponseField type="string[] | [string, TData][]" required>
|
|
47
|
+
Matching indexes, or index-value pairs when values are requested. TypeScript returns indexes as strings; Python returns integers. No matches returns an empty list.
|
|
48
|
+
</ResponseField>
|
|
49
|
+
|
|
50
|
+
Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
|
|
51
|
+
|
|
52
|
+
<RequestExample>
|
|
53
|
+
```ts Example
|
|
54
|
+
await redis.arset("logs", 0, "error: disk", "ok", "ERROR: network");
|
|
55
|
+
console.log(await redis.argrep("logs", "-", "+", {
|
|
56
|
+
predicates: [{ match: "error" }],
|
|
57
|
+
noCase: true,
|
|
58
|
+
})); // ["0", "2"]
|
|
59
|
+
|
|
60
|
+
console.log(await redis.argrep("logs", "-", "+", {
|
|
61
|
+
predicates: [{ glob: "error:*" }, { match: "disk" }],
|
|
62
|
+
combine: "AND",
|
|
63
|
+
withValues: true,
|
|
64
|
+
limit: 10,
|
|
65
|
+
})); // [["0", "error: disk"]]
|
|
66
|
+
```
|
|
67
|
+
</RequestExample>
|
|
68
|
+
|
|
69
|
+
See the [server command reference](/redis/commands/array/argrep) for protocol details.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARINFO
|
|
3
|
+
description: Inspect array size, storage layout, and append position.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The array key.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="options" type="Object">
|
|
13
|
+
<ParamField body="full" type="boolean">
|
|
14
|
+
Include per-slice statistics. Defaults to false. Enabling this walks the whole array.
|
|
15
|
+
</ParamField>
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
## Response
|
|
19
|
+
|
|
20
|
+
<ResponseField type="ArInfoResult" required>
|
|
21
|
+
An object with camelCase field names in TypeScript, or a dictionary with snake_case field names in Python. A missing key raises an error.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
| Field | Type | Meaning |
|
|
25
|
+
| --- | --- | --- |
|
|
26
|
+
| `len` | `string` | Highest occupied index plus one. |
|
|
27
|
+
| `count` | `number` | Number of occupied slots. |
|
|
28
|
+
| `sliceSize` | `number` | Indexes covered by one slice. |
|
|
29
|
+
| `slices` | `number` | Allocated slices. |
|
|
30
|
+
| `directorySize` | `number` | Slice directory entries. |
|
|
31
|
+
| `superDirEntries` | `number` | Top-level directory entries. |
|
|
32
|
+
| `nextInsertIndex` | `string` | Next append position. |
|
|
33
|
+
| `denseSlices` | `number` | Dense slices. Only with full statistics. |
|
|
34
|
+
| `sparseSlices` | `number` | Sparse slices. Only with full statistics. |
|
|
35
|
+
| `avgDenseSize` | `number` | Average values per dense slice. Only with full statistics. |
|
|
36
|
+
| `avgDenseFill` | `number` | Average dense-slice fill ratio. Only with full statistics. |
|
|
37
|
+
| `avgSparseSize` | `number` | Average values per sparse slice. Only with full statistics. |
|
|
38
|
+
|
|
39
|
+
<RequestExample>
|
|
40
|
+
```ts Example
|
|
41
|
+
await redis.arinsert("events", "boot", "ready");
|
|
42
|
+
const info = await redis.arinfo("events");
|
|
43
|
+
console.log(info.len, info.count, info.nextInsertIndex); // "2", 2, "2"
|
|
44
|
+
const fullInfo = await redis.arinfo("events", { full: true });
|
|
45
|
+
console.log(fullInfo.denseSlices, fullInfo.sparseSlices);
|
|
46
|
+
```
|
|
47
|
+
</RequestExample>
|
|
48
|
+
|
|
49
|
+
See the [server command reference](/redis/commands/array/arinfo) for protocol details.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARINSERT
|
|
3
|
+
description: Append values after the array append cursor.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
On a new array, appends start at index zero. [ARSET](./arset) and [ARMSET](./armset) leave the cursor unchanged, so appending after positional writes can overwrite values. Use [ARSEEK](./arseek) to choose the next append index.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="values" type="...TData[]" required>
|
|
15
|
+
One or more values to write.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
## Response
|
|
19
|
+
|
|
20
|
+
<ResponseField type="string" required>
|
|
21
|
+
The index where the last value was written, as a string in TypeScript or an integer in Python.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
console.log(await redis.arinsert("events", "boot", "ready")); // "1"
|
|
27
|
+
console.log(await redis.arinsert("events", "running")); // "2"
|
|
28
|
+
console.log(await redis.arnext("events")); // "3"
|
|
29
|
+
```
|
|
30
|
+
</RequestExample>
|
|
31
|
+
|
|
32
|
+
See the [server command reference](/redis/commands/array/arinsert) for protocol details.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARLASTITEMS
|
|
3
|
+
description: Read the most recently appended array values.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Reads walk backward from the append cursor and wrap at index zero. Positional writes do not move that cursor.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="count" type="number" required>
|
|
15
|
+
The maximum number of values to return. Must be nonnegative and is capped at the number of stored values.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="options" type="Object">
|
|
19
|
+
<ParamField body="rev" type="boolean">
|
|
20
|
+
Return newest values first. Defaults to false.
|
|
21
|
+
</ParamField>
|
|
22
|
+
</ParamField>
|
|
23
|
+
|
|
24
|
+
## Response
|
|
25
|
+
|
|
26
|
+
<ResponseField type="(TData | null)[]" required>
|
|
27
|
+
Values in oldest-first order, or newest-first when `rev` is enabled. Empty slots are returned as `null` (TypeScript) / `None` (Python). A missing key returns an empty list.
|
|
28
|
+
</ResponseField>
|
|
29
|
+
|
|
30
|
+
Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
|
|
31
|
+
|
|
32
|
+
<RequestExample>
|
|
33
|
+
```ts Example
|
|
34
|
+
await redis.arring("recent", 3, "a", "b", "c", "d");
|
|
35
|
+
console.log(await redis.arlastitems("recent", 3)); // ["b", "c", "d"]
|
|
36
|
+
console.log(await redis.arlastitems("recent", 3, { rev: true })); // ["d", "c", "b"]
|
|
37
|
+
```
|
|
38
|
+
</RequestExample>
|
|
39
|
+
|
|
40
|
+
See the [server command reference](/redis/commands/array/arlastitems) for protocol details.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARLEN
|
|
3
|
+
description: Get the highest occupied array index plus one.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Use [ARCOUNT](./arcount) to count stored values.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
## Response
|
|
15
|
+
|
|
16
|
+
<ResponseField type="string" required>
|
|
17
|
+
The highest occupied index plus one. A missing key returns `"0"` in TypeScript or `0` in Python. TypeScript returns a string even for small lengths.
|
|
18
|
+
</ResponseField>
|
|
19
|
+
|
|
20
|
+
<RequestExample>
|
|
21
|
+
```ts Example
|
|
22
|
+
await redis.arset("readings", 1000, "sample");
|
|
23
|
+
console.log(await redis.arlen("readings")); // "1001"
|
|
24
|
+
console.log(await redis.arcount("readings")); // 1
|
|
25
|
+
```
|
|
26
|
+
</RequestExample>
|
|
27
|
+
|
|
28
|
+
See the [server command reference](/redis/commands/array/arlen) for protocol details.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARMGET
|
|
3
|
+
description: Read several array slots in request order.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The array key.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
<ParamField body="indexes" type="...(number | string)[]" required>
|
|
13
|
+
One or more indexes, passed as separate arguments.
|
|
14
|
+
</ParamField>
|
|
15
|
+
|
|
16
|
+
## Response
|
|
17
|
+
|
|
18
|
+
<ResponseField type="(TData | null)[]" required>
|
|
19
|
+
One value per requested index, with `null` (TypeScript) / `None` (Python) for empty slots or missing keys.
|
|
20
|
+
</ResponseField>
|
|
21
|
+
|
|
22
|
+
Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
await redis.armset("readings", { 0: "a", 10: "b" });
|
|
27
|
+
console.log(await redis.armget("readings", 10, 5, 0)); // ["b", null, "a"]
|
|
28
|
+
```
|
|
29
|
+
</RequestExample>
|
|
30
|
+
|
|
31
|
+
See the [server command reference](/redis/commands/array/armget) for protocol details.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARMSET
|
|
3
|
+
description: Write values at several array indexes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
These writes leave the append cursor unchanged.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="values" type="Record<number | string, TData> | [number | string, TData][]" required>
|
|
15
|
+
A mapping of indexes to values, or an iterable of index-value pairs. Provide at least one pair.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
## Response
|
|
19
|
+
|
|
20
|
+
<ResponseField type="number" required>
|
|
21
|
+
The number of previously empty slots that were filled.
|
|
22
|
+
</ResponseField>
|
|
23
|
+
|
|
24
|
+
<RequestExample>
|
|
25
|
+
```ts Example
|
|
26
|
+
console.log(await redis.armset("readings", { 0: "a", 10: "b" })); // 2
|
|
27
|
+
console.log(await redis.armset("readings", [[10, "B"], [20, "c"]])); // 1
|
|
28
|
+
```
|
|
29
|
+
</RequestExample>
|
|
30
|
+
|
|
31
|
+
See the [server command reference](/redis/commands/array/armset) for protocol details.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARNEXT
|
|
3
|
+
description: Read the next append index without moving the cursor.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Arguments
|
|
7
|
+
|
|
8
|
+
<ParamField body="key" type="string" required>
|
|
9
|
+
The array key.
|
|
10
|
+
</ParamField>
|
|
11
|
+
|
|
12
|
+
## Response
|
|
13
|
+
|
|
14
|
+
<ResponseField type="string | null" required>
|
|
15
|
+
The next append index. A missing key or an array without appends returns `"0"` in TypeScript or `0` in Python. Returns `null` / `None` when the cursor has reached the highest supported index.
|
|
16
|
+
</ResponseField>
|
|
17
|
+
|
|
18
|
+
<RequestExample>
|
|
19
|
+
```ts Example
|
|
20
|
+
await redis.arinsert("events", "boot", "ready");
|
|
21
|
+
console.log(await redis.arnext("events")); // "2"
|
|
22
|
+
```
|
|
23
|
+
</RequestExample>
|
|
24
|
+
|
|
25
|
+
See the [server command reference](/redis/commands/array/arnext) for protocol details.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: AROP
|
|
3
|
+
description: Aggregate values in an inclusive array range.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`SUM`, `MIN`, and `MAX` aggregate numeric values. `AND`, `OR`, and `XOR` fold values as 64-bit integers, truncating fractions. These operations skip non-numeric values. `USED` counts occupied slots. `MATCH` counts values equal to the supplied value.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="start" type="number | string" required>
|
|
15
|
+
The first index of the inclusive range.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="end" type="number | string" required>
|
|
19
|
+
The last index of the inclusive range.
|
|
20
|
+
</ParamField>
|
|
21
|
+
|
|
22
|
+
<ParamField body="operation" type="ArOpOperation<TData>" required>
|
|
23
|
+
The reduction to apply. See the operations below.
|
|
24
|
+
</ParamField>
|
|
25
|
+
|
|
26
|
+
Pass `"SUM"`, `"MIN"`, `"MAX"`, `"AND"`, `"OR"`, `"XOR"`, or `"USED"` (lowercase is also accepted). For equality matching, pass `{ match: value }` as the operation.
|
|
27
|
+
|
|
28
|
+
## Response
|
|
29
|
+
|
|
30
|
+
<ResponseField type="number | null" required>
|
|
31
|
+
The numeric aggregate, or `null` (TypeScript) / `None` (Python) if no values can be used. `USED` and `MATCH` return zero for an empty range.
|
|
32
|
+
</ResponseField>
|
|
33
|
+
|
|
34
|
+
<RequestExample>
|
|
35
|
+
```ts Example
|
|
36
|
+
await redis.arset("readings", 0, 1, 2, 3);
|
|
37
|
+
console.log(await redis.arop("readings", 0, 2, "SUM")); // 6
|
|
38
|
+
|
|
39
|
+
await redis.arset("statuses", 0, "ok", "error", "error");
|
|
40
|
+
console.log(await redis.arop("statuses", 0, 2, { match: "error" })); // 2
|
|
41
|
+
```
|
|
42
|
+
</RequestExample>
|
|
43
|
+
|
|
44
|
+
See the [server command reference](/redis/commands/array/arop) for protocol details.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: ARRING
|
|
3
|
+
description: Append values to a fixed-size ring buffer.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Writes wrap to index zero when the ring is full and overwrite the oldest values. Calling this command with a different size reshapes the ring.
|
|
7
|
+
|
|
8
|
+
## Arguments
|
|
9
|
+
|
|
10
|
+
<ParamField body="key" type="string" required>
|
|
11
|
+
The array key.
|
|
12
|
+
</ParamField>
|
|
13
|
+
|
|
14
|
+
<ParamField body="size" type="number" required>
|
|
15
|
+
The number of slots in the ring. Must be greater than zero.
|
|
16
|
+
</ParamField>
|
|
17
|
+
|
|
18
|
+
<ParamField body="values" type="...TData[]" required>
|
|
19
|
+
One or more values to write.
|
|
20
|
+
</ParamField>
|
|
21
|
+
|
|
22
|
+
## Response
|
|
23
|
+
|
|
24
|
+
<ResponseField type="string" required>
|
|
25
|
+
The index where the last value was written, as a string in TypeScript or an integer in Python.
|
|
26
|
+
</ResponseField>
|
|
27
|
+
|
|
28
|
+
<RequestExample>
|
|
29
|
+
```ts Example
|
|
30
|
+
console.log(await redis.arring("recent", 3, "a", "b", "c")); // "2"
|
|
31
|
+
console.log(await redis.arring("recent", 3, "d")); // "0"
|
|
32
|
+
console.log(await redis.arlastitems("recent", 3)); // ["b", "c", "d"]
|
|
33
|
+
```
|
|
34
|
+
</RequestExample>
|
|
35
|
+
|
|
36
|
+
See the [server command reference](/redis/commands/array/arring) for protocol details.
|