@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,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Redis TypeScript SDK Getting Started
|
|
3
|
+
sidebarTitle: Get Started
|
|
4
|
+
description: "Install @upstash/redis, connect to your Upstash Redis database over HTTP, and run your first commands from TypeScript or JavaScript."
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<Tip>
|
|
8
|
+
If you are an AI agent and need a Redis DB to use or experiment with, send a POST request to https://upstash.com/start-redis. Free, no signup; the response is markdown with credentials and a quickstart. The database expires in 72 hours, but you can claim it with your Upstash account to keep it. Especially useful for AI agents that need scratch storage on the fly. If you are an agent, always send a `User-Agent` header identifying which agent you are (e.g. `claude-code`, `cursor`, `codex`, `opencode`) on every request you make to this API.
|
|
9
|
+
</Tip>
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Install `@upstash/redis` from npm:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @upstash/redis
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
yarn add @upstash/redis
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add @upstash/redis
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
In Deno, import it straight from npm with no install step:
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
import { Redis } from "npm:@upstash/redis";
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Basic Usage:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { Redis } from "@upstash/redis"
|
|
36
|
+
|
|
37
|
+
const redis = new Redis({
|
|
38
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
39
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// string
|
|
43
|
+
await redis.set('key', 'value');
|
|
44
|
+
let data = await redis.get('key');
|
|
45
|
+
console.log(data)
|
|
46
|
+
|
|
47
|
+
await redis.set('key2', 'value2', {ex: 1});
|
|
48
|
+
|
|
49
|
+
// sorted set
|
|
50
|
+
await redis.zadd('scores', { score: 1, member: 'team1' })
|
|
51
|
+
data = await redis.zrange('scores', 0, 100 )
|
|
52
|
+
console.log(data)
|
|
53
|
+
|
|
54
|
+
// list
|
|
55
|
+
await redis.lpush('elements', 'magnesium')
|
|
56
|
+
data = await redis.lrange('elements', 0, 100 )
|
|
57
|
+
console.log(data)
|
|
58
|
+
|
|
59
|
+
// hash
|
|
60
|
+
await redis.hset('people', {name: 'joe'})
|
|
61
|
+
data = await redis.hget('people', 'name' )
|
|
62
|
+
console.log(data)
|
|
63
|
+
|
|
64
|
+
// sets
|
|
65
|
+
await redis.sadd('animals', 'cat')
|
|
66
|
+
data = await redis.spop('animals', 1)
|
|
67
|
+
console.log(data)
|
|
68
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Redis TypeScript SDK Overview
|
|
3
|
+
sidebarTitle: Overview
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
[@upstash/redis](https://github.com/upstash/redis-js)
|
|
7
|
+
is an HTTP/REST based Redis client built on top of
|
|
8
|
+
[Upstash REST API](/redis/features/restapi).
|
|
9
|
+
|
|
10
|
+
[](https://github.com/upstash/redis-js/actions/workflows/tests.yaml)
|
|
11
|
+

|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
It is the only connectionless (HTTP based) Redis client and designed for:
|
|
15
|
+
|
|
16
|
+
- Serverless functions (AWS Lambda)
|
|
17
|
+
- Cloudflare Workers (see
|
|
18
|
+
[the example](https://github.com/upstash/redis-js/tree/main/examples/cloudflare-workers))
|
|
19
|
+
- Fastly Compute@Edge (see
|
|
20
|
+
[the example](https://github.com/upstash/redis-js/tree/main/examples/fastly))
|
|
21
|
+
- Next.js (see [the quickstart](/redis/quickstarts/nextjs-app-router)), Jamstack
|
|
22
|
+
- Client side web/mobile applications
|
|
23
|
+
- WebAssembly
|
|
24
|
+
- and other environments where HTTP is preferred over TCP.
|
|
25
|
+
|
|
26
|
+
See
|
|
27
|
+
[the list of APIs](/redis/features/restapi#rest-redis-api-compatibility)
|
|
28
|
+
supported by the Upstash REST API. For typed `@upstash/redis` command helpers,
|
|
29
|
+
see the [TypeScript SDK command reference](/redis/sdks/ts/commands/overview).
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Auto-Pipelining
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
### Auto Pipelining
|
|
6
|
+
|
|
7
|
+
Auto pipelining allows you to use the Redis client as usual
|
|
8
|
+
while in the background it tries to send requests in batches
|
|
9
|
+
whenever possible.
|
|
10
|
+
|
|
11
|
+
In a nutshell, the client will accumulate commands in a pipeline
|
|
12
|
+
and wait for a short amount of time for more commands to arrive.
|
|
13
|
+
When there are no more commands, it will execute them as a batch.
|
|
14
|
+
|
|
15
|
+
This feature is enabled by default. To disable it, simply pass `enableAutoPipelining: false`
|
|
16
|
+
when creating the Redis client:
|
|
17
|
+
|
|
18
|
+
<CodeGroup>
|
|
19
|
+
|
|
20
|
+
```ts Redis
|
|
21
|
+
import { Redis } from "@upstash/redis";
|
|
22
|
+
|
|
23
|
+
const redis = Redis.fromEnv({
|
|
24
|
+
enableAutoPipelining: false
|
|
25
|
+
});
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts fromEnv
|
|
29
|
+
import { Redis } from "@upstash/redis";
|
|
30
|
+
|
|
31
|
+
const redis = new Redis({
|
|
32
|
+
url: <UPSTASH_REDIS_REST_URL>,
|
|
33
|
+
token: <UPSTASH_REDIS_REST_TOKEN>,
|
|
34
|
+
enableAutoPipelining: true
|
|
35
|
+
})
|
|
36
|
+
```
|
|
37
|
+
</CodeGroup>
|
|
38
|
+
|
|
39
|
+
This is especially useful in cases when we want to make async
|
|
40
|
+
requests or when we want to make requests in batches.
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import { Redis } from "@upstash/redis";
|
|
44
|
+
|
|
45
|
+
const redis = Redis.fromEnv({
|
|
46
|
+
latencyLogging: false,
|
|
47
|
+
enableAutoPipelining: true
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// async call to redis. Not executed right away, instead
|
|
51
|
+
// added to the pipeline
|
|
52
|
+
redis.hincrby("Brooklyn", "visited", 1);
|
|
53
|
+
|
|
54
|
+
// making requests in batches
|
|
55
|
+
const brooklynInfo = Promise.all([
|
|
56
|
+
redis.hget("Brooklyn", "coordinates"),
|
|
57
|
+
redis.hget("Brooklyn", "population")
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
// when we call await, the three commands are executed
|
|
61
|
+
// as a pipeline automatically. A single PIPELINE command
|
|
62
|
+
// is executed instead of three requests and the results
|
|
63
|
+
// are returned:
|
|
64
|
+
const [ coordinates, population ] = await brooklynInfo;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
The benefit of auto pipelining is that it reduces the number
|
|
68
|
+
of HTTP requests made like pipelining and transaction while
|
|
69
|
+
being extremely simple to enable and use. It's especially
|
|
70
|
+
useful in cases like Vercel Edge and [Cloudflare Workers, where the number of
|
|
71
|
+
simultaneous requests is limited by 6](https://developers.cloudflare.com/workers/platform/limits/#account-plan-limits).
|
|
72
|
+
|
|
73
|
+
To learn more about how auto pipelining can be utilized in a
|
|
74
|
+
project, see
|
|
75
|
+
[the auto-pipeline example project under `upstash-redis` repository](https://github.com/upstash/upstash-redis/tree/main/examples/auto-pipeline)
|
|
76
|
+
|
|
77
|
+
### How it Works
|
|
78
|
+
|
|
79
|
+
For auto pipeline to work, the client keeps an active pipeline
|
|
80
|
+
and adds incoming commands to this pipeline. After the command
|
|
81
|
+
is added to the pipeline, execution of the pipeline is delayed
|
|
82
|
+
by releasing the control of the Node thread.
|
|
83
|
+
|
|
84
|
+
The pipeline executes when one of these two conditions are met:
|
|
85
|
+
No more commands are being added or at least one of the commands
|
|
86
|
+
added is being 'awaited'.
|
|
87
|
+
|
|
88
|
+
This means that if you are awaiting every time you run a command,
|
|
89
|
+
you won't benefit much from auto pipelining since each await will
|
|
90
|
+
trigger a pipeline:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
const foo = await redis.get("foo") // makes a PIPELINE call
|
|
94
|
+
const bar = await redis.get("bar") // makes another PIPELINE call
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
In these cases, we suggest using `Promise.all`:
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
// makes a single PIPELINE call:
|
|
101
|
+
const [ foo, bar ] = await Promise.all([
|
|
102
|
+
redis.get("foo"),
|
|
103
|
+
redis.get("bar")
|
|
104
|
+
])
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
In addition to resulting in a single PIPELINE call, the commands
|
|
108
|
+
in `Promise.all` are executed in the order they are written!
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Pipeline & Transaction
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
### Pipeline
|
|
6
|
+
|
|
7
|
+
Pipelining commands allows you to send a single http request with multiple
|
|
8
|
+
commands. Keep in mind, that the execution of pipelines is not atomic and the
|
|
9
|
+
execution of other commands can interleave.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Redis } from "@upstash/redis";
|
|
13
|
+
|
|
14
|
+
const redis = new Redis({
|
|
15
|
+
/* auth */
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
const p = redis.pipeline();
|
|
19
|
+
|
|
20
|
+
// Now you can chain multiple commands to create your pipeline:
|
|
21
|
+
|
|
22
|
+
p.set("key", 2);
|
|
23
|
+
p.incr("key");
|
|
24
|
+
|
|
25
|
+
// or inline:
|
|
26
|
+
p.hset("key2", "field", { hello: "world" }).hvals("key2");
|
|
27
|
+
|
|
28
|
+
// Execute the pipeline once you are done building it:
|
|
29
|
+
// `exec` returns an array where each element represents the response of a command in the pipeline.
|
|
30
|
+
// You can optionally provide a type like this to get a typed response.
|
|
31
|
+
const res = await p.exec<[Type1, Type2, Type3]>();
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
For more information about pipelines using REST see
|
|
35
|
+
[here](https://blog.upstash.com/pipeline).
|
|
36
|
+
|
|
37
|
+
If you wish to benefit from pipeline automatically,
|
|
38
|
+
you can simply enable auto-pipelining to make your redis client
|
|
39
|
+
handle the commands in batches in the background. See
|
|
40
|
+
[the Auto-pipelining page](https://docs.upstash.com/redis/sdks/ts/pipelining/auto-pipeline).
|
|
41
|
+
|
|
42
|
+
### Transaction
|
|
43
|
+
|
|
44
|
+
Remember that the pipeline is able to send multiple commands at once but
|
|
45
|
+
can't execute them atomically. With transactions, you can make the commands
|
|
46
|
+
execute atomically.
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
import { Redis } from "@upstash/redis";
|
|
50
|
+
|
|
51
|
+
const redis = new Redis({
|
|
52
|
+
/* auth */
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const p = redis.multi();
|
|
56
|
+
|
|
57
|
+
p.set("key", 2);
|
|
58
|
+
p.incr("key");
|
|
59
|
+
|
|
60
|
+
// or inline:
|
|
61
|
+
p.hset("key2", "field", { hello: "world" }).hvals("key2");
|
|
62
|
+
|
|
63
|
+
// execute the transaction
|
|
64
|
+
const res = await p.exec<[Type1, Type2, Type3]>();
|
|
65
|
+
```
|
package/docs/retries.mdx
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Redis TypeScript SDK Retries
|
|
3
|
+
sidebarTitle: Retries
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
By default `@upstash/redis` will retry sending you request when network errors
|
|
7
|
+
occur. It will retry 5 times with a backoff of
|
|
8
|
+
`(retryCount) => Math.exp(retryCount) * 50` milliseconds.
|
|
9
|
+
|
|
10
|
+
You can customize this in the `Redis` constructor:
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
new Redis({
|
|
14
|
+
url: UPSTASH_REDIS_REST_URL,
|
|
15
|
+
token: UPSTASH_REDIS_REST_TOKEN,
|
|
16
|
+
retry: {
|
|
17
|
+
retries: 5,
|
|
18
|
+
backoff: (retryCount) => Math.exp(retryCount) * 50,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The exact type definition can be found
|
|
24
|
+
[here](https://github.com/upstash/upstash-redis/blob/4948b049e0d580d1de0a4cbfeac5565d7e035cc4/pkg/http.ts#LL31C1-L49C5).
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Redis TypeScript SDK Troubleshooting
|
|
3
|
+
sidebarTitle: Troubleshooting
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## ReferenceError: fetch is not defined
|
|
7
|
+
|
|
8
|
+
#### Problem
|
|
9
|
+
|
|
10
|
+
If you are running on nodejs v17 and earlier, fetch will not be natively
|
|
11
|
+
supported. Platforms like Vercel, Netlify, Deno, Fastly etc. provide a polyfill
|
|
12
|
+
for you. But if you are running on bare node, you need to add a polyfill.
|
|
13
|
+
|
|
14
|
+
#### Solution
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm i isomorphic-fetch
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { Redis } from "@upstash/redis";
|
|
22
|
+
import "isomorphic-fetch";
|
|
23
|
+
|
|
24
|
+
const redis = new Redis({
|
|
25
|
+
/*...*/
|
|
26
|
+
});
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Hashed Response
|
|
30
|
+
|
|
31
|
+
The response from a server is not what you expect but looks like a hash?
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
await redis.set("key", "value");
|
|
35
|
+
const data = await redis.get("key");
|
|
36
|
+
console.log(data);
|
|
37
|
+
|
|
38
|
+
// dmFsdWU=
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
#### Problem
|
|
42
|
+
|
|
43
|
+
Versions of `@upstash/redis` before 1.40.0 request base64 encoded responses from
|
|
44
|
+
the server by default. If a response reaches your code without being decoded,
|
|
45
|
+
you see the base64 encoded value.
|
|
46
|
+
|
|
47
|
+
#### Solution
|
|
48
|
+
|
|
49
|
+
Upgrade to `@upstash/redis` 1.40.0 or later, which requests plain responses by
|
|
50
|
+
default, or set `responseEncoding` to `false` in the options.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
const redis = new Redis({
|
|
54
|
+
// ...
|
|
55
|
+
responseEncoding: false,
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Large numbers are returned as string
|
|
60
|
+
|
|
61
|
+
You are trying to load a large number and it is returned as a string instead.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
await redis.set("key", "101600000000150081467");
|
|
65
|
+
const res = await redis("get");
|
|
66
|
+
|
|
67
|
+
// "101600000000150081467"
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### Problem
|
|
71
|
+
|
|
72
|
+
Javascript can not handle numbers larger than `2^53 -1` safely and would return
|
|
73
|
+
wrong results when trying to deserialize them. In these cases the default
|
|
74
|
+
deserializer will return them as string instead. This might cause a mismatch
|
|
75
|
+
with your custom types.
|
|
76
|
+
|
|
77
|
+
#### Solution
|
|
78
|
+
|
|
79
|
+
Please be aware that this is a limitation of javascript and take special care
|
|
80
|
+
when handling large numbers.
|