@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.
Files changed (475) hide show
  1. package/README.md +5 -0
  2. package/{chunk-RLVWMRRX.mjs → chunk-CGMWROAN.mjs} +557 -4
  3. package/cloudflare.d.mts +2 -2
  4. package/cloudflare.d.ts +2 -2
  5. package/cloudflare.js +557 -4
  6. package/cloudflare.mjs +1 -1
  7. package/docs/advanced.mdx +83 -0
  8. package/docs/commands/array/arcount.mdx +28 -0
  9. package/docs/commands/array/ardel.mdx +30 -0
  10. package/docs/commands/array/ardelrange.mdx +32 -0
  11. package/docs/commands/array/arget.mdx +33 -0
  12. package/docs/commands/array/argetrange.mdx +38 -0
  13. package/docs/commands/array/argrep.mdx +69 -0
  14. package/docs/commands/array/arinfo.mdx +49 -0
  15. package/docs/commands/array/arinsert.mdx +32 -0
  16. package/docs/commands/array/arlastitems.mdx +40 -0
  17. package/docs/commands/array/arlen.mdx +28 -0
  18. package/docs/commands/array/armget.mdx +31 -0
  19. package/docs/commands/array/armset.mdx +31 -0
  20. package/docs/commands/array/arnext.mdx +25 -0
  21. package/docs/commands/array/arop.mdx +44 -0
  22. package/docs/commands/array/arring.mdx +36 -0
  23. package/docs/commands/array/arscan.mdx +42 -0
  24. package/docs/commands/array/arseek.mdx +34 -0
  25. package/docs/commands/array/arset.mdx +35 -0
  26. package/docs/commands/auth/echo.mdx +24 -0
  27. package/docs/commands/auth/ping.mdx +21 -0
  28. package/docs/commands/bitmap/bitcount.mdx +39 -0
  29. package/docs/commands/bitmap/bitop.mdx +142 -0
  30. package/docs/commands/bitmap/bitpos.mdx +39 -0
  31. package/docs/commands/bitmap/getbit.mdx +28 -0
  32. package/docs/commands/bitmap/setbit.mdx +31 -0
  33. package/docs/commands/connection/client_setinfo.mdx +91 -0
  34. package/docs/commands/functions/call.mdx +72 -0
  35. package/docs/commands/functions/call_ro.mdx +57 -0
  36. package/docs/commands/functions/delete.mdx +22 -0
  37. package/docs/commands/functions/flush.mdx +16 -0
  38. package/docs/commands/functions/list.mdx +72 -0
  39. package/docs/commands/functions/load.mdx +64 -0
  40. package/docs/commands/functions/stats.mdx +46 -0
  41. package/docs/commands/generic/del.mdx +29 -0
  42. package/docs/commands/generic/exists.mdx +26 -0
  43. package/docs/commands/generic/expire.mdx +29 -0
  44. package/docs/commands/generic/expireat.mdx +29 -0
  45. package/docs/commands/generic/keys.mdx +32 -0
  46. package/docs/commands/generic/persist.mdx +23 -0
  47. package/docs/commands/generic/pexpire.mdx +28 -0
  48. package/docs/commands/generic/pexpireat.mdx +29 -0
  49. package/docs/commands/generic/pttl.mdx +23 -0
  50. package/docs/commands/generic/randomkey.mdx +21 -0
  51. package/docs/commands/generic/rename.mdx +28 -0
  52. package/docs/commands/generic/renamenx.mdx +28 -0
  53. package/docs/commands/generic/scan.mdx +38 -0
  54. package/docs/commands/generic/touch.mdx +23 -0
  55. package/docs/commands/generic/ttl.mdx +23 -0
  56. package/docs/commands/generic/type.mdx +27 -0
  57. package/docs/commands/generic/unlink.mdx +29 -0
  58. package/docs/commands/hash/hdel.mdx +28 -0
  59. package/docs/commands/hash/hexists.mdx +30 -0
  60. package/docs/commands/hash/hexpire.mdx +49 -0
  61. package/docs/commands/hash/hexpireat.mdx +48 -0
  62. package/docs/commands/hash/hexpiretime.mdx +35 -0
  63. package/docs/commands/hash/hget.mdx +29 -0
  64. package/docs/commands/hash/hgetall.mdx +27 -0
  65. package/docs/commands/hash/hgetdel.mdx +67 -0
  66. package/docs/commands/hash/hgetex.mdx +123 -0
  67. package/docs/commands/hash/hincrby.mdx +34 -0
  68. package/docs/commands/hash/hincrbyfloat.mdx +34 -0
  69. package/docs/commands/hash/hkeys.mdx +28 -0
  70. package/docs/commands/hash/hlen.mdx +28 -0
  71. package/docs/commands/hash/hmget.mdx +33 -0
  72. package/docs/commands/hash/hpersist.mdx +37 -0
  73. package/docs/commands/hash/hpexpire.mdx +50 -0
  74. package/docs/commands/hash/hpexpireat.mdx +48 -0
  75. package/docs/commands/hash/hpexpiretime.mdx +35 -0
  76. package/docs/commands/hash/hpttl.mdx +35 -0
  77. package/docs/commands/hash/hrandfield.mdx +57 -0
  78. package/docs/commands/hash/hscan.mdx +65 -0
  79. package/docs/commands/hash/hset.mdx +32 -0
  80. package/docs/commands/hash/hsetex.mdx +186 -0
  81. package/docs/commands/hash/hsetnx.mdx +30 -0
  82. package/docs/commands/hash/hstrlen.mdx +28 -0
  83. package/docs/commands/hash/httl.mdx +35 -0
  84. package/docs/commands/hash/hvals.mdx +29 -0
  85. package/docs/commands/json/arrappend.mdx +35 -0
  86. package/docs/commands/json/arrindex.mdx +37 -0
  87. package/docs/commands/json/arrinsert.mdx +34 -0
  88. package/docs/commands/json/arrlen.mdx +26 -0
  89. package/docs/commands/json/arrpop.mdx +36 -0
  90. package/docs/commands/json/arrtrim.mdx +34 -0
  91. package/docs/commands/json/clear.mdx +30 -0
  92. package/docs/commands/json/del.mdx +26 -0
  93. package/docs/commands/json/forget.mdx +26 -0
  94. package/docs/commands/json/get.mdx +53 -0
  95. package/docs/commands/json/merge.mdx +32 -0
  96. package/docs/commands/json/mget.mdx +27 -0
  97. package/docs/commands/json/mset.mdx +26 -0
  98. package/docs/commands/json/numincrby.mdx +33 -0
  99. package/docs/commands/json/nummultby.mdx +33 -0
  100. package/docs/commands/json/objkeys.mdx +27 -0
  101. package/docs/commands/json/objlen.mdx +27 -0
  102. package/docs/commands/json/set.mdx +42 -0
  103. package/docs/commands/json/strappend.mdx +32 -0
  104. package/docs/commands/json/strlen.mdx +26 -0
  105. package/docs/commands/json/toggle.mdx +28 -0
  106. package/docs/commands/json/type.mdx +28 -0
  107. package/docs/commands/list/lindex.mdx +32 -0
  108. package/docs/commands/list/linsert.mdx +41 -0
  109. package/docs/commands/list/llen.mdx +26 -0
  110. package/docs/commands/list/lmove.mdx +34 -0
  111. package/docs/commands/list/lpop.mdx +37 -0
  112. package/docs/commands/list/lpos.mdx +56 -0
  113. package/docs/commands/list/lpush.mdx +32 -0
  114. package/docs/commands/list/lpushx.mdx +38 -0
  115. package/docs/commands/list/lrange.mdx +37 -0
  116. package/docs/commands/list/lrem.mdx +33 -0
  117. package/docs/commands/list/lset.mdx +34 -0
  118. package/docs/commands/list/ltrim.mdx +33 -0
  119. package/docs/commands/list/rpop.mdx +37 -0
  120. package/docs/commands/list/rpush.mdx +32 -0
  121. package/docs/commands/list/rpushx.mdx +38 -0
  122. package/docs/commands/overview.mdx +692 -0
  123. package/docs/commands/pubsub/psubscribe.mdx +36 -0
  124. package/docs/commands/pubsub/publish.mdx +27 -0
  125. package/docs/commands/pubsub/subscribe.mdx +28 -0
  126. package/docs/commands/scripts/eval.mdx +36 -0
  127. package/docs/commands/scripts/eval_ro.mdx +36 -0
  128. package/docs/commands/scripts/evalsha.mdx +36 -0
  129. package/docs/commands/scripts/evalsha_ro.mdx +36 -0
  130. package/docs/commands/scripts/script_exists.mdx +26 -0
  131. package/docs/commands/scripts/script_flush.mdx +28 -0
  132. package/docs/commands/scripts/script_load.mdx +28 -0
  133. package/docs/commands/server/dbsize.mdx +22 -0
  134. package/docs/commands/server/flushall.mdx +25 -0
  135. package/docs/commands/server/flushdb.mdx +25 -0
  136. package/docs/commands/set/sadd.mdx +32 -0
  137. package/docs/commands/set/scard.mdx +26 -0
  138. package/docs/commands/set/sdiff.mdx +27 -0
  139. package/docs/commands/set/sdiffstore.mdx +32 -0
  140. package/docs/commands/set/sinter.mdx +27 -0
  141. package/docs/commands/set/sinterstore.mdx +33 -0
  142. package/docs/commands/set/sismember.mdx +30 -0
  143. package/docs/commands/set/smembers.mdx +25 -0
  144. package/docs/commands/set/smismember.mdx +31 -0
  145. package/docs/commands/set/smove.mdx +34 -0
  146. package/docs/commands/set/spop.mdx +36 -0
  147. package/docs/commands/set/srandmember.mdx +36 -0
  148. package/docs/commands/set/srem.mdx +29 -0
  149. package/docs/commands/set/sscan.mdx +39 -0
  150. package/docs/commands/set/sunion.mdx +27 -0
  151. package/docs/commands/set/sunionstore.mdx +33 -0
  152. package/docs/commands/stream/xack.mdx +37 -0
  153. package/docs/commands/stream/xackdel.mdx +211 -0
  154. package/docs/commands/stream/xadd.mdx +137 -0
  155. package/docs/commands/stream/xautoclaim.mdx +80 -0
  156. package/docs/commands/stream/xclaim.mdx +84 -0
  157. package/docs/commands/stream/xdel.mdx +34 -0
  158. package/docs/commands/stream/xdelex.mdx +119 -0
  159. package/docs/commands/stream/xgroup.mdx +141 -0
  160. package/docs/commands/stream/xinfo.mdx +77 -0
  161. package/docs/commands/stream/xlen.mdx +22 -0
  162. package/docs/commands/stream/xpending.mdx +75 -0
  163. package/docs/commands/stream/xrange.mdx +59 -0
  164. package/docs/commands/stream/xread.mdx +65 -0
  165. package/docs/commands/stream/xreadgroup.mdx +87 -0
  166. package/docs/commands/stream/xrevrange.mdx +65 -0
  167. package/docs/commands/stream/xtrim.mdx +75 -0
  168. package/docs/commands/string/append.mdx +28 -0
  169. package/docs/commands/string/decr.mdx +27 -0
  170. package/docs/commands/string/decrby.mdx +30 -0
  171. package/docs/commands/string/get.mdx +34 -0
  172. package/docs/commands/string/getdel.mdx +29 -0
  173. package/docs/commands/string/getrange.mdx +34 -0
  174. package/docs/commands/string/getset.mdx +28 -0
  175. package/docs/commands/string/incr.mdx +27 -0
  176. package/docs/commands/string/incrby.mdx +30 -0
  177. package/docs/commands/string/incrbyfloat.mdx +30 -0
  178. package/docs/commands/string/mget.mdx +31 -0
  179. package/docs/commands/string/mset.mdx +32 -0
  180. package/docs/commands/string/msetnx.mdx +29 -0
  181. package/docs/commands/string/set.mdx +79 -0
  182. package/docs/commands/string/setrange.mdx +38 -0
  183. package/docs/commands/string/strlen.mdx +26 -0
  184. package/docs/commands/transaction.mdx +22 -0
  185. package/docs/commands/zset/zadd.mdx +102 -0
  186. package/docs/commands/zset/zcard.mdx +31 -0
  187. package/docs/commands/zset/zcount.mdx +47 -0
  188. package/docs/commands/zset/zdiffstore.mdx +33 -0
  189. package/docs/commands/zset/zincrby.mdx +37 -0
  190. package/docs/commands/zset/zinterstore.mdx +98 -0
  191. package/docs/commands/zset/zlexcount.mdx +43 -0
  192. package/docs/commands/zset/zmscore.mdx +34 -0
  193. package/docs/commands/zset/zpopmax.mdx +25 -0
  194. package/docs/commands/zset/zpopmin.mdx +25 -0
  195. package/docs/commands/zset/zrange.mdx +85 -0
  196. package/docs/commands/zset/zrank.mdx +29 -0
  197. package/docs/commands/zset/zrem.mdx +33 -0
  198. package/docs/commands/zset/zremrangebylex.mdx +32 -0
  199. package/docs/commands/zset/zremrangebyrank.mdx +32 -0
  200. package/docs/commands/zset/zremrangebyscore.mdx +32 -0
  201. package/docs/commands/zset/zrevrank.mdx +29 -0
  202. package/docs/commands/zset/zscan.mdx +58 -0
  203. package/docs/commands/zset/zscore.mdx +34 -0
  204. package/docs/commands/zset/zunionstore.mdx +98 -0
  205. package/docs/deployment.mdx +117 -0
  206. package/docs/developing.mdx +118 -0
  207. package/docs/getstarted.mdx +68 -0
  208. package/docs/overview.mdx +29 -0
  209. package/docs/pipelining/auto-pipeline.mdx +108 -0
  210. package/docs/pipelining/pipeline-transaction.mdx +65 -0
  211. package/docs/retries.mdx +24 -0
  212. package/docs/troubleshooting.mdx +80 -0
  213. package/{error-BNzLTXJG.d.mts → error-4e36-PC0.d.mts} +838 -8
  214. package/{error-BNzLTXJG.d.ts → error-4e36-PC0.d.ts} +838 -8
  215. package/fastly.d.mts +2 -2
  216. package/fastly.d.ts +2 -2
  217. package/fastly.js +557 -4
  218. package/fastly.mjs +1 -1
  219. package/nodejs.d.mts +34 -2
  220. package/nodejs.d.ts +34 -2
  221. package/nodejs.js +586 -4
  222. package/nodejs.mjs +30 -1
  223. package/package.json +16 -5
  224. package/src/pkg/auto-pipeline.ts +284 -0
  225. package/src/pkg/commands/append.ts +12 -0
  226. package/src/pkg/commands/arcount.ts +14 -0
  227. package/src/pkg/commands/ardel.ts +19 -0
  228. package/src/pkg/commands/ardelrange.ts +19 -0
  229. package/src/pkg/commands/arget.ts +17 -0
  230. package/src/pkg/commands/argetrange.ts +20 -0
  231. package/src/pkg/commands/argrep.ts +109 -0
  232. package/src/pkg/commands/arinfo.ts +88 -0
  233. package/src/pkg/commands/arinsert.ts +24 -0
  234. package/src/pkg/commands/arlastitems.ts +29 -0
  235. package/src/pkg/commands/arlen.ts +23 -0
  236. package/src/pkg/commands/armget.ts +18 -0
  237. package/src/pkg/commands/armset.ts +26 -0
  238. package/src/pkg/commands/arnext.ts +20 -0
  239. package/src/pkg/commands/arop.ts +48 -0
  240. package/src/pkg/commands/arring.ts +23 -0
  241. package/src/pkg/commands/arscan.ts +44 -0
  242. package/src/pkg/commands/arseek.ts +17 -0
  243. package/src/pkg/commands/arset.ts +20 -0
  244. package/src/pkg/commands/bitcount.ts +30 -0
  245. package/src/pkg/commands/bitfield.ts +50 -0
  246. package/src/pkg/commands/bitop.ts +35 -0
  247. package/src/pkg/commands/bitpos.ts +15 -0
  248. package/src/pkg/commands/client_setinfo.ts +17 -0
  249. package/src/pkg/commands/command.ts +142 -0
  250. package/src/pkg/commands/copy.ts +22 -0
  251. package/src/pkg/commands/dbsize.ts +12 -0
  252. package/src/pkg/commands/decr.ts +12 -0
  253. package/src/pkg/commands/decrby.ts +12 -0
  254. package/src/pkg/commands/del.ts +12 -0
  255. package/src/pkg/commands/echo.ts +12 -0
  256. package/src/pkg/commands/eval.ts +18 -0
  257. package/src/pkg/commands/evalRo.ts +18 -0
  258. package/src/pkg/commands/evalsha.ts +18 -0
  259. package/src/pkg/commands/evalshaRo.ts +18 -0
  260. package/src/pkg/commands/exec.ts +23 -0
  261. package/src/pkg/commands/exists.ts +12 -0
  262. package/src/pkg/commands/expire.ts +13 -0
  263. package/src/pkg/commands/expireat.ts +16 -0
  264. package/src/pkg/commands/fcall.ts +15 -0
  265. package/src/pkg/commands/fcall_ro.ts +18 -0
  266. package/src/pkg/commands/flushall.ts +15 -0
  267. package/src/pkg/commands/flushdb.ts +15 -0
  268. package/src/pkg/commands/function_delete.ts +12 -0
  269. package/src/pkg/commands/function_flush.ts +12 -0
  270. package/src/pkg/commands/function_list.ts +77 -0
  271. package/src/pkg/commands/function_load.ts +31 -0
  272. package/src/pkg/commands/function_stats.ts +42 -0
  273. package/src/pkg/commands/geo_add.ts +54 -0
  274. package/src/pkg/commands/geo_dist.ts +19 -0
  275. package/src/pkg/commands/geo_hash.ts +23 -0
  276. package/src/pkg/commands/geo_pos.ts +39 -0
  277. package/src/pkg/commands/geo_search.ts +140 -0
  278. package/src/pkg/commands/geo_search_store.ts +69 -0
  279. package/src/pkg/commands/get.ts +15 -0
  280. package/src/pkg/commands/getbit.ts +12 -0
  281. package/src/pkg/commands/getdel.ts +15 -0
  282. package/src/pkg/commands/getex.ts +36 -0
  283. package/src/pkg/commands/getrange.ts +15 -0
  284. package/src/pkg/commands/getset.ts +15 -0
  285. package/src/pkg/commands/hdel.ts +12 -0
  286. package/src/pkg/commands/hexists.ts +12 -0
  287. package/src/pkg/commands/hexpire.ts +30 -0
  288. package/src/pkg/commands/hexpireat.ts +30 -0
  289. package/src/pkg/commands/hexpiretime.ts +13 -0
  290. package/src/pkg/commands/hget.ts +18 -0
  291. package/src/pkg/commands/hgetall.ts +44 -0
  292. package/src/pkg/commands/hgetdel.ts +30 -0
  293. package/src/pkg/commands/hgetex.ts +56 -0
  294. package/src/pkg/commands/hincrby.ts +15 -0
  295. package/src/pkg/commands/hincrbyfloat.ts +15 -0
  296. package/src/pkg/commands/hkeys.ts +12 -0
  297. package/src/pkg/commands/hlen.ts +12 -0
  298. package/src/pkg/commands/hmget.ts +53 -0
  299. package/src/pkg/commands/hmset.ts +14 -0
  300. package/src/pkg/commands/hpersist.ts +13 -0
  301. package/src/pkg/commands/hpexpire.ts +30 -0
  302. package/src/pkg/commands/hpexpireat.ts +30 -0
  303. package/src/pkg/commands/hpexpiretime.ts +13 -0
  304. package/src/pkg/commands/hpttl.ts +13 -0
  305. package/src/pkg/commands/hrandfield.ts +52 -0
  306. package/src/pkg/commands/hscan.ts +31 -0
  307. package/src/pkg/commands/hset.ts +15 -0
  308. package/src/pkg/commands/hsetex.ts +59 -0
  309. package/src/pkg/commands/hsetnx.ts +15 -0
  310. package/src/pkg/commands/hstrlen.ts +12 -0
  311. package/src/pkg/commands/httl.ts +13 -0
  312. package/src/pkg/commands/hvals.ts +12 -0
  313. package/src/pkg/commands/incr.ts +12 -0
  314. package/src/pkg/commands/incrby.ts +12 -0
  315. package/src/pkg/commands/incrbyfloat.ts +12 -0
  316. package/src/pkg/commands/json_arrappend.ts +18 -0
  317. package/src/pkg/commands/json_arrindex.ts +15 -0
  318. package/src/pkg/commands/json_arrinsert.ts +18 -0
  319. package/src/pkg/commands/json_arrlen.ts +15 -0
  320. package/src/pkg/commands/json_arrpop.ts +15 -0
  321. package/src/pkg/commands/json_arrtrim.ts +19 -0
  322. package/src/pkg/commands/json_clear.ts +12 -0
  323. package/src/pkg/commands/json_del.ts +12 -0
  324. package/src/pkg/commands/json_forget.ts +12 -0
  325. package/src/pkg/commands/json_get.ts +45 -0
  326. package/src/pkg/commands/json_merge.ts +18 -0
  327. package/src/pkg/commands/json_mget.ts +12 -0
  328. package/src/pkg/commands/json_mset.ts +27 -0
  329. package/src/pkg/commands/json_numincrby.ts +15 -0
  330. package/src/pkg/commands/json_nummultby.ts +15 -0
  331. package/src/pkg/commands/json_objkeys.ts +15 -0
  332. package/src/pkg/commands/json_objlen.ts +15 -0
  333. package/src/pkg/commands/json_resp.ts +11 -0
  334. package/src/pkg/commands/json_set.ts +35 -0
  335. package/src/pkg/commands/json_strappend.ts +15 -0
  336. package/src/pkg/commands/json_strlen.ts +15 -0
  337. package/src/pkg/commands/json_toggle.ts +12 -0
  338. package/src/pkg/commands/json_type.ts +12 -0
  339. package/src/pkg/commands/keys.ts +12 -0
  340. package/src/pkg/commands/lindex.ts +11 -0
  341. package/src/pkg/commands/linsert.ts +10 -0
  342. package/src/pkg/commands/llen.ts +12 -0
  343. package/src/pkg/commands/lmove.ts +20 -0
  344. package/src/pkg/commands/lmpop.ts +19 -0
  345. package/src/pkg/commands/lpop.ts +18 -0
  346. package/src/pkg/commands/lpos.ts +26 -0
  347. package/src/pkg/commands/lpush.ts +12 -0
  348. package/src/pkg/commands/lpushx.ts +12 -0
  349. package/src/pkg/commands/lrange.ts +11 -0
  350. package/src/pkg/commands/lrem.ts +10 -0
  351. package/src/pkg/commands/lset.ts +8 -0
  352. package/src/pkg/commands/ltrim.ts +8 -0
  353. package/src/pkg/commands/mget.ts +15 -0
  354. package/src/pkg/commands/mod.ts +222 -0
  355. package/src/pkg/commands/mset.ts +12 -0
  356. package/src/pkg/commands/msetnx.ts +12 -0
  357. package/src/pkg/commands/persist.ts +12 -0
  358. package/src/pkg/commands/pexpire.ts +16 -0
  359. package/src/pkg/commands/pexpireat.ts +16 -0
  360. package/src/pkg/commands/pfadd.ts +11 -0
  361. package/src/pkg/commands/pfcount.ts +11 -0
  362. package/src/pkg/commands/pfmerge.ts +11 -0
  363. package/src/pkg/commands/ping.ts +15 -0
  364. package/src/pkg/commands/psetex.ts +14 -0
  365. package/src/pkg/commands/psubscribe.ts +26 -0
  366. package/src/pkg/commands/pttl.ts +12 -0
  367. package/src/pkg/commands/publish.ts +12 -0
  368. package/src/pkg/commands/randomkey.ts +12 -0
  369. package/src/pkg/commands/rename.ts +12 -0
  370. package/src/pkg/commands/renamenx.ts +12 -0
  371. package/src/pkg/commands/rpop.ts +21 -0
  372. package/src/pkg/commands/rpush.ts +12 -0
  373. package/src/pkg/commands/rpushx.ts +12 -0
  374. package/src/pkg/commands/sadd.ts +15 -0
  375. package/src/pkg/commands/scan.ts +63 -0
  376. package/src/pkg/commands/scard.ts +11 -0
  377. package/src/pkg/commands/script_exists.ts +15 -0
  378. package/src/pkg/commands/script_flush.ts +22 -0
  379. package/src/pkg/commands/script_load.ts +12 -0
  380. package/src/pkg/commands/sdiff.ts +11 -0
  381. package/src/pkg/commands/sdiffstore.ts +14 -0
  382. package/src/pkg/commands/search/command-builder.ts +162 -0
  383. package/src/pkg/commands/search/index.ts +4 -0
  384. package/src/pkg/commands/search/schema-builder.ts +320 -0
  385. package/src/pkg/commands/search/search.ts +218 -0
  386. package/src/pkg/commands/search/types.ts +1029 -0
  387. package/src/pkg/commands/search/utils.ts +275 -0
  388. package/src/pkg/commands/set.ts +52 -0
  389. package/src/pkg/commands/setbit.ts +15 -0
  390. package/src/pkg/commands/setex.ts +11 -0
  391. package/src/pkg/commands/setnx.ts +11 -0
  392. package/src/pkg/commands/setrange.ts +15 -0
  393. package/src/pkg/commands/sinter.ts +11 -0
  394. package/src/pkg/commands/sintercard.ts +19 -0
  395. package/src/pkg/commands/sinterstore.ts +14 -0
  396. package/src/pkg/commands/sismember.ts +11 -0
  397. package/src/pkg/commands/smembers.ts +12 -0
  398. package/src/pkg/commands/smismember.ts +17 -0
  399. package/src/pkg/commands/smove.ts +14 -0
  400. package/src/pkg/commands/spop.ts +18 -0
  401. package/src/pkg/commands/srandmember.ts +18 -0
  402. package/src/pkg/commands/srem.ts +11 -0
  403. package/src/pkg/commands/sscan.ts +31 -0
  404. package/src/pkg/commands/strlen.ts +12 -0
  405. package/src/pkg/commands/subscribe.ts +254 -0
  406. package/src/pkg/commands/sunion.ts +12 -0
  407. package/src/pkg/commands/sunionstore.ts +15 -0
  408. package/src/pkg/commands/time.ts +10 -0
  409. package/src/pkg/commands/touch.ts +12 -0
  410. package/src/pkg/commands/ttl.ts +12 -0
  411. package/src/pkg/commands/type.ts +13 -0
  412. package/src/pkg/commands/types.ts +201 -0
  413. package/src/pkg/commands/unlink.ts +12 -0
  414. package/src/pkg/commands/vector/index.ts +11 -0
  415. package/src/pkg/commands/vector/types.ts +63 -0
  416. package/src/pkg/commands/vector/utils.ts +67 -0
  417. package/src/pkg/commands/vector/vector.ts +131 -0
  418. package/src/pkg/commands/vector_add.ts +18 -0
  419. package/src/pkg/commands/vector_count.ts +11 -0
  420. package/src/pkg/commands/vector_create.ts +28 -0
  421. package/src/pkg/commands/vector_del.ts +13 -0
  422. package/src/pkg/commands/vector_drop.ts +13 -0
  423. package/src/pkg/commands/vector_get.ts +18 -0
  424. package/src/pkg/commands/vector_info.ts +25 -0
  425. package/src/pkg/commands/vector_query.ts +24 -0
  426. package/src/pkg/commands/xack.ts +16 -0
  427. package/src/pkg/commands/xackdel.ts +21 -0
  428. package/src/pkg/commands/xadd.ts +70 -0
  429. package/src/pkg/commands/xautoclaim.ts +31 -0
  430. package/src/pkg/commands/xclaim.ts +56 -0
  431. package/src/pkg/commands/xdel.ts +16 -0
  432. package/src/pkg/commands/xdelex.ts +25 -0
  433. package/src/pkg/commands/xgroup.ts +101 -0
  434. package/src/pkg/commands/xinfo.ts +28 -0
  435. package/src/pkg/commands/xlen.ts +12 -0
  436. package/src/pkg/commands/xpending.ts +44 -0
  437. package/src/pkg/commands/xrange.ts +49 -0
  438. package/src/pkg/commands/xread.ts +78 -0
  439. package/src/pkg/commands/xreadgroup.ts +74 -0
  440. package/src/pkg/commands/xrevrange.ts +48 -0
  441. package/src/pkg/commands/xtrim.ts +25 -0
  442. package/src/pkg/commands/zadd.ts +54 -0
  443. package/src/pkg/commands/zcard.ts +12 -0
  444. package/src/pkg/commands/zcount.ts +14 -0
  445. package/src/pkg/commands/zdiffstore.ts +15 -0
  446. package/src/pkg/commands/zincrby.ts +14 -0
  447. package/src/pkg/commands/zinterstore.ts +51 -0
  448. package/src/pkg/commands/zlexcount.ts +11 -0
  449. package/src/pkg/commands/zmscore.ts +16 -0
  450. package/src/pkg/commands/zpopmax.ts +18 -0
  451. package/src/pkg/commands/zpopmin.ts +18 -0
  452. package/src/pkg/commands/zrange.ts +72 -0
  453. package/src/pkg/commands/zrank.ts +14 -0
  454. package/src/pkg/commands/zrem.ts +11 -0
  455. package/src/pkg/commands/zremrangebylex.ts +11 -0
  456. package/src/pkg/commands/zremrangebyrank.ts +14 -0
  457. package/src/pkg/commands/zremrangebyscore.ts +18 -0
  458. package/src/pkg/commands/zrevrank.ts +14 -0
  459. package/src/pkg/commands/zscan.ts +31 -0
  460. package/src/pkg/commands/zscore.ts +15 -0
  461. package/src/pkg/commands/zunion.ts +54 -0
  462. package/src/pkg/commands/zunionstore.ts +52 -0
  463. package/src/pkg/error.ts +28 -0
  464. package/src/pkg/http.ts +458 -0
  465. package/src/pkg/index.ts +1 -0
  466. package/src/pkg/pipeline.ts +2041 -0
  467. package/src/pkg/redis.ts +2130 -0
  468. package/src/pkg/script.ts +100 -0
  469. package/src/pkg/scriptRo.ts +98 -0
  470. package/src/pkg/types.ts +35 -0
  471. package/src/pkg/util.ts +115 -0
  472. package/src/platforms/cloudflare.ts +162 -0
  473. package/src/platforms/fastly.ts +105 -0
  474. package/src/platforms/nodejs.ts +231 -0
  475. package/src/version.ts +1 -0
@@ -0,0 +1,42 @@
1
+ ---
2
+ title: ARSCAN
3
+ description: Read occupied array slots with their indexes.
4
+ ---
5
+
6
+ ## Arguments
7
+
8
+ <ParamField body="key" type="string" required>
9
+ The array key.
10
+ </ParamField>
11
+
12
+ <ParamField body="start" type="number | string" required>
13
+ The first index of the inclusive range.
14
+ </ParamField>
15
+
16
+ <ParamField body="end" type="number | string" required>
17
+ The last index of the inclusive range.
18
+ </ParamField>
19
+
20
+ <ParamField body="options" type="Object">
21
+ <ParamField body="limit" type="number">
22
+ Maximum number of occupied slots to return. If provided, it must be greater than zero.
23
+ </ParamField>
24
+ </ParamField>
25
+
26
+ ## Response
27
+
28
+ <ResponseField type="[string, TData][]" required>
29
+ Index-value pairs for occupied slots. Empty slots are skipped; a missing key returns an empty list. TypeScript returns indexes as strings; Python returns integers.
30
+ </ResponseField>
31
+
32
+ Values use the SDK's automatic deserialization. Use `TData` to describe stored JSON values; it defaults to `string`.
33
+
34
+ <RequestExample>
35
+ ```ts Example
36
+ await redis.armset("readings", { 10: "a", 1000: "b" });
37
+ console.log(await redis.arscan("readings", 0, 1000, { limit: 2 }));
38
+ // [["10", "a"], ["1000", "b"]]
39
+ ```
40
+ </RequestExample>
41
+
42
+ See the [server command reference](/redis/commands/array/arscan) for protocol details.
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: ARSEEK
3
+ description: Choose the index where the next append will write.
4
+ ---
5
+
6
+ Moves only the append cursor; existing values are unchanged. The key must already exist.
7
+
8
+ ## Arguments
9
+
10
+ <ParamField body="key" type="string" required>
11
+ The array key.
12
+ </ParamField>
13
+
14
+ <ParamField body="index" type="number | string" required>
15
+ The index where the next ARINSERT should write.
16
+ </ParamField>
17
+
18
+ ## Response
19
+
20
+ <ResponseField type="0 | 1" required>
21
+ TypeScript returns `1` if the cursor was set and `0` if the key does not exist. Python returns `True` or `False`, respectively.
22
+ </ResponseField>
23
+
24
+ <RequestExample>
25
+ ```ts Example
26
+ await redis.arset("readings", 10, "existing");
27
+ const nextIndex = await redis.arlen("readings");
28
+ console.log(await redis.arseek("readings", nextIndex)); // 1
29
+ console.log(await redis.arinsert("readings", "new")); // "11"
30
+ console.log(await redis.arget("readings", 10)); // "existing"
31
+ ```
32
+ </RequestExample>
33
+
34
+ See the [server command reference](/redis/commands/array/arseek) for protocol details.
@@ -0,0 +1,35 @@
1
+ ---
2
+ title: ARSET
3
+ description: Write consecutive values starting at an array index.
4
+ ---
5
+
6
+ Positional writes leave the append cursor unchanged. To append after positional writes, use [ARSEEK](./arseek) with the length returned by [ARLEN](./arlen).
7
+
8
+ ## Arguments
9
+
10
+ <ParamField body="key" type="string" required>
11
+ The array key.
12
+ </ParamField>
13
+
14
+ <ParamField body="index" type="number | string" required>
15
+ The zero-based index to access.
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="number" required>
25
+ The number of previously empty slots that were filled. Overwriting a value contributes zero.
26
+ </ResponseField>
27
+
28
+ <RequestExample>
29
+ ```ts Example
30
+ console.log(await redis.arset("readings", 0, 21.5, 21.7)); // 2
31
+ console.log(await redis.arset("readings", 1, 22.1)); // 0
32
+ ```
33
+ </RequestExample>
34
+
35
+ See the [server command reference](/redis/commands/array/arset) for protocol details.
@@ -0,0 +1,24 @@
1
+ ---
2
+ title: ECHO
3
+ ---
4
+
5
+ Returns a message back to you. Useful for debugging the connection.
6
+
7
+ ## Arguments
8
+
9
+ <ParamField body="message" type="string" required>
10
+ A message to send to the server.
11
+ </ParamField>
12
+
13
+ ## Response
14
+
15
+ <ResponseField type="string" required>
16
+ The same message you sent.
17
+ </ResponseField>
18
+
19
+ <RequestExample>
20
+ ```ts Example
21
+ const response = await redis.echo("hello world");
22
+ console.log(response); // "hello world"
23
+ ```
24
+ </RequestExample>
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: PING
3
+ description: Send a ping to the server and get a response if the server is alive.
4
+ ---
5
+
6
+ ## Arguments
7
+
8
+ No arguments
9
+
10
+ ## Response
11
+
12
+ <ResponseField type="string" required>
13
+ `PONG`
14
+ </ResponseField>
15
+
16
+ <RequestExample>
17
+ ```ts Example
18
+ const response = await redis.ping();
19
+ console.log(response); // "PONG"
20
+ ```
21
+ </RequestExample>
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: BITCOUNT
3
+ description: Count the number of set bits.
4
+ ---
5
+
6
+ The `BITCOUNT` command in Redis is used to count the number of set bits (bits with a value of 1) in a range of bytes within a key that is stored as a binary string. It is primarily used for bit-level operations on binary data stored in Redis.
7
+
8
+ ## Arguments
9
+
10
+ <ParamField body="key" type="string" required>
11
+ The key to get.
12
+ </ParamField>
13
+
14
+ <ParamField body="start" type="integer">
15
+ Specify the range of bytes within the binary string to count the set bits. If not provided, it counts set bits in the entire string.
16
+
17
+ Either specify both `start` and `end` or neither.
18
+
19
+ </ParamField>
20
+
21
+ <ParamField body="end" type="integer">
22
+ Specify the range of bytes within the binary string to count the set bits. If not provided, it counts set bits in the entire string.
23
+
24
+ Either specify both `start` and `end` or neither.
25
+ </ParamField>
26
+ ## Response
27
+
28
+ <ResponseField type="integer" required>
29
+ The number of set bits in the specified range.
30
+ </ResponseField>
31
+
32
+ <RequestExample>
33
+ ```ts Example
34
+ const bits = await redis.bitcount(key);
35
+ ```
36
+ ```ts With Range
37
+ const bits = await redis.bitcount(key, 5, 10);
38
+ ```
39
+ </RequestExample>
@@ -0,0 +1,142 @@
1
+ ---
2
+ title: BITOP
3
+ description: Perform bitwise operations between strings.
4
+ ---
5
+
6
+ The `BITOP` command in Redis is used to perform bitwise operations on multiple keys (or Redis strings) and store the result in a destination key. It supports standard logical operations (AND, OR, XOR, NOT) and advanced operations (DIFF, DIFF1, ANDOR, ONE) for complex bit manipulation.
7
+
8
+
9
+ ## Arguments
10
+
11
+ <ParamField body="operation" type="'and' | 'or' | 'xor' | 'not' | 'diff' | 'diff1' | 'andor' | 'one'" required>
12
+ Specifies the type of bitwise operation to perform:
13
+
14
+ **Standard Operations:**
15
+ - `and`: Bitwise AND
16
+ - `or`: Bitwise OR
17
+ - `xor`: Bitwise XOR
18
+ - `not`: Bitwise NOT (only accepts one source key)
19
+
20
+ **Advanced Operations (Redis 8.2+):**
21
+ - `diff`: A bit is set only if it's set in all source bitmaps
22
+ - `diff1`: A bit is set if it's set in the first key but not in any of the other keys
23
+ - `andor`: A bit is set if it's set in X and also in one or more of Y1, Y2, ...
24
+ - `one`: A bit is set if it's set in exactly one source key
25
+ </ParamField>
26
+
27
+ <ParamField body="destinationKey" type="string" required>
28
+ The key to store the result of the operation in.
29
+ </ParamField>
30
+
31
+ <ParamField body="sourceKeys" type="...string[]" required >
32
+ One or more keys to perform the operation on.
33
+ </ParamField>
34
+
35
+ ## Response
36
+
37
+ <ResponseField type="integer" required>
38
+ The size of the string stored in the destination key.
39
+ </ResponseField>
40
+
41
+ <RequestExample>
42
+ ```ts Standard Operations
43
+ // AND operation
44
+ await redis.bitop("and", "destKey", "sourceKey1", "sourceKey2");
45
+
46
+ // OR operation
47
+ await redis.bitop("or", "destKey", "sourceKey1", "sourceKey2");
48
+
49
+ // XOR operation
50
+ await redis.bitop("xor", "destKey", "sourceKey1", "sourceKey2");
51
+
52
+ // NOT operation (only accepts one source key)
53
+ await redis.bitop("not", "destKey", "sourceKey");
54
+ ```
55
+
56
+ ```ts DIFF Operation (Redis 8.2+)
57
+ // Set bits in multiple bitmaps
58
+ await redis.setbit("bitmap1", 0, 1);
59
+ await redis.setbit("bitmap1", 1, 1);
60
+ await redis.setbit("bitmap2", 1, 1);
61
+ await redis.setbit("bitmap2", 2, 1);
62
+
63
+ // DIFF: bits set in all sources
64
+ await redis.bitop("diff", "result", "bitmap1", "bitmap2");
65
+ // Result: bit 1 is set (only bit present in both)
66
+ ```
67
+
68
+ ```ts DIFF1 Operation (Redis 8.2+)
69
+ // Set bits in bitmaps
70
+ await redis.setbit("exclude", 0, 1);
71
+ await redis.setbit("exclude", 1, 1);
72
+ await redis.setbit("include1", 1, 1);
73
+ await redis.setbit("include2", 2, 1);
74
+
75
+ // DIFF1: bits in first key but not in others
76
+ await redis.bitop("diff1", "result", "exclude", "include1", "include2");
77
+ // Result: bit 0 is set (only in exclude, not in include1 or include2)
78
+ ```
79
+
80
+ ```ts ANDOR Operation (Redis 8.2+)
81
+ // Set bits in bitmaps
82
+ await redis.setbit("required", 0, 1);
83
+ await redis.setbit("required", 1, 1);
84
+ await redis.setbit("option1", 1, 1);
85
+ await redis.setbit("option2", 2, 1);
86
+
87
+ // ANDOR: bits in required AND in at least one option
88
+ await redis.bitop("andor", "result", "required", "option1", "option2");
89
+ // Result: bit 1 is set (in required AND in option1)
90
+ ```
91
+
92
+ ```ts ONE Operation (Redis 8.2+)
93
+ // Set bits in multiple sources
94
+ await redis.setbit("source1", 0, 1);
95
+ await redis.setbit("source1", 1, 1);
96
+ await redis.setbit("source2", 1, 1);
97
+ await redis.setbit("source2", 2, 1);
98
+ await redis.setbit("source3", 2, 1);
99
+
100
+ // ONE: bits set in exactly one source
101
+ await redis.bitop("one", "result", "source1", "source2", "source3");
102
+ // Result: bit 0 is set (only in source1)
103
+ ```
104
+ </RequestExample>
105
+
106
+ ## Advanced Operations Details (Redis 8.2+)
107
+
108
+ ### DIFF
109
+ A bit in the destination is set if it is set in **all** source bitmaps. This is equivalent to the intersection of all source bitmaps.
110
+
111
+ **Use Cases:**
112
+ - Finding common features across multiple datasets
113
+ - Identifying users present in all segments
114
+ - Intersection of multiple filters
115
+
116
+ ### DIFF1
117
+ A bit in the destination is set if it is set in the **first key** but **not in any of the other keys**. This finds bits unique to the first bitmap.
118
+
119
+ **Use Cases:**
120
+ - Finding exclusive features
121
+ - Identifying users in one segment but not in others
122
+ - Exclusion filtering
123
+
124
+ ### ANDOR
125
+ A bit in the destination is set if it is set in **X and also in one or more of Y1, Y2, ...**. This implements "X AND (Y1 OR Y2 OR ...)" logic.
126
+
127
+ **Use Cases:**
128
+ - Required condition with optional alternatives
129
+ - Users with a required attribute and at least one optional attribute
130
+ - Complex filtering with mandatory and optional criteria
131
+
132
+ ### ONE
133
+ A bit in the destination is set if it is set in **exactly one** of the source keys. This finds bits that are unique to a single source.
134
+
135
+ **Use Cases:**
136
+ - Finding unique occurrences
137
+ - Identifying exclusive memberships
138
+ - Detecting singular conditions across multiple sets
139
+
140
+ <Note>
141
+ The advanced operations (DIFF, DIFF1, ANDOR, ONE) are available in Redis 8.2.0 and later.
142
+ </Note>
@@ -0,0 +1,39 @@
1
+ ---
2
+ title: BITPOS
3
+ description: Find the position of the first set or clear bit (bit with a value of 1 or 0) in a Redis string key.
4
+ ---
5
+
6
+ ## Arguments
7
+
8
+ <ParamField body="key" type="string" required>
9
+ The key to search in.
10
+ </ParamField>
11
+
12
+ <ParamField body="bit" type="0 | 1" required>
13
+ The key to store the result of the operation in.
14
+ </ParamField>
15
+
16
+ <ParamField body="start" type="number" >
17
+ The index to start searching at.
18
+ </ParamField>
19
+
20
+ <ParamField body="end" type="number" >
21
+ The index to stop searching at.
22
+ </ParamField>
23
+
24
+ ## Response
25
+
26
+ <ResponseField type="integer" required>
27
+ The index of the first occurrence of the bit in the string.
28
+ </ResponseField>
29
+
30
+ <RequestExample>
31
+ ```ts Example
32
+ await redis.bitpos("key", 1);
33
+ ```
34
+
35
+ ```ts With Range
36
+ await redis.bitpos("key", 1, 5, 20);
37
+ ```
38
+
39
+ </RequestExample>
@@ -0,0 +1,28 @@
1
+ ---
2
+ title: GETBIT
3
+ description: Retrieve a single bit.
4
+ ---
5
+
6
+
7
+ ## Arguments
8
+
9
+ <ParamField body="key" type="string" required>
10
+ The key of the bitset
11
+ </ParamField>
12
+
13
+ <ParamField body="offset" type="integer" required>
14
+ Specify the offset at which to get the bit.
15
+
16
+ </ParamField>
17
+
18
+ ## Response
19
+
20
+ <ResponseField type="integer" required>
21
+ The bit value stored at offset.
22
+ </ResponseField>
23
+
24
+ <RequestExample>
25
+ ```ts Example
26
+ const bit = await redis.getbit(key, 4);
27
+ ```
28
+ </RequestExample>
@@ -0,0 +1,31 @@
1
+ ---
2
+ title: SETBIT
3
+ description: Set a single bit in a string.
4
+ ---
5
+
6
+
7
+ ## Arguments
8
+
9
+ <ParamField body="key" type="string" required>
10
+ The key of the bitset
11
+ </ParamField>
12
+
13
+ <ParamField body="offset" type="integer" required>
14
+ Specify the offset at which to set the bit.
15
+ </ParamField>
16
+
17
+ <ParamField body="value" type="0 | 1" required>
18
+ The bit to set
19
+ </ParamField>
20
+
21
+ ## Response
22
+
23
+ <ResponseField type="0 | 1" required>
24
+ The original bit value stored at offset.
25
+ </ResponseField>
26
+
27
+ <RequestExample>
28
+ ```ts Example
29
+ const originalBit = await redis.setbit(key, 4, 1);
30
+ ```
31
+ </RequestExample>
@@ -0,0 +1,91 @@
1
+ ---
2
+ title: CLIENT SETINFO
3
+ description: Set client library name and version information.
4
+ ---
5
+
6
+ The `CLIENT SETINFO` command sets client library name and version information that will be shown in CLIENT LIST and CLIENT INFO commands. This helps identify which client library is being used and is useful for debugging and monitoring.
7
+
8
+ ## Arguments
9
+
10
+ <ParamField body="attribute" type="'LIB-NAME' | 'LIB-VER'" required>
11
+ The attribute to set:
12
+ - `LIB-NAME` or `lib-name`: Library name
13
+ - `LIB-VER` or `lib-ver`: Library version
14
+ </ParamField>
15
+
16
+ <ParamField body="value" type="string" required>
17
+ The value to set for the attribute.
18
+ </ParamField>
19
+
20
+ ## Response
21
+
22
+ <ResponseField type="string" required>
23
+ Returns `OK` if the attribute was successfully set.
24
+ </ResponseField>
25
+
26
+ <RequestExample>
27
+ ```ts Set Library Name
28
+ // Set the library name
29
+ await redis.clientSetInfo("LIB-NAME", "redis-js");
30
+ // Returns: "OK"
31
+ ```
32
+
33
+ ```ts Set Library Version
34
+ // Set the library version
35
+ await redis.clientSetInfo("LIB-VER", "1.0.0");
36
+ // Returns: "OK"
37
+ ```
38
+
39
+ ```ts Lowercase Attributes
40
+ // Attributes are case-insensitive
41
+ await redis.clientSetInfo("lib-name", "redis-js");
42
+ await redis.clientSetInfo("lib-ver", "2.0.0");
43
+ ```
44
+
45
+ ```ts With Custom Suffix
46
+ // Common pattern: include wrapper or framework info
47
+ await redis.clientSetInfo("LIB-NAME", "redis-js(upstash_v1.0.0)");
48
+ await redis.clientSetInfo("LIB-VER", "1.0.0");
49
+ ```
50
+
51
+ ```ts Complete Setup
52
+ // Set both library name and version
53
+ await redis.clientSetInfo("LIB-NAME", "my-redis-wrapper");
54
+ await redis.clientSetInfo("LIB-VER", "3.2.1");
55
+
56
+ // Now this information will appear in CLIENT LIST output
57
+ ```
58
+ </RequestExample>
59
+
60
+ ## Use Cases
61
+
62
+ - **Debugging**: Identify which client library version is being used
63
+ - **Monitoring**: Track different client libraries connecting to Redis
64
+ - **Analytics**: Understand client library distribution across connections
65
+ - **Support**: Quickly identify client versions when troubleshooting issues
66
+
67
+ ## Viewing Client Information
68
+
69
+ After setting client info, you can view it using the CLIENT LIST command:
70
+
71
+ ```ts
72
+ // Set client information
73
+ await redis.clientSetInfo("LIB-NAME", "redis-js");
74
+ await redis.clientSetInfo("LIB-VER", "1.0.0");
75
+
76
+ // View all clients (if you have access to CLIENT LIST)
77
+ // The output will include lib-name and lib-ver fields
78
+ ```
79
+
80
+ ## Best Practices
81
+
82
+ 1. **Set on Connection**: Set client info immediately after establishing a connection
83
+ 2. **Include Version**: Always set both library name and version
84
+ 3. **Use Descriptive Names**: Make library names easily identifiable
85
+ 4. **Version Format**: Use semantic versioning (e.g., "1.2.3")
86
+ 5. **Include Context**: Add wrapper or framework info if applicable
87
+
88
+ <Note>
89
+ This command is available in Redis 7.2.0 and later. The attribute names are case-insensitive and will be normalized to uppercase.
90
+ </Note>
91
+
@@ -0,0 +1,72 @@
1
+ ---
2
+ title: FCALL
3
+ description: Invoke a function.
4
+ ---
5
+
6
+ ## Arguments
7
+
8
+ <ParamField body="function" type="string" required>
9
+ The function name.
10
+ </ParamField>
11
+
12
+ <ParamField body="keys" type="string[]">
13
+ The keys that the function accesses.
14
+ <Warning>
15
+ The function can only read/write from the keys that are provided in the `keys` argument.
16
+ </Warning>
17
+ </ParamField>
18
+
19
+ <ParamField body="args" type="string[]">
20
+ The arguments for the function.
21
+ </ParamField>
22
+
23
+ ## Response
24
+
25
+ <ResponseField type="unknown" required>
26
+ The return value of the function.
27
+ </ResponseField>
28
+
29
+ <RequestExample>
30
+ ```ts Basic
31
+ const code = `
32
+ #!lua name=mylib
33
+ redis.register_function('helloworld',
34
+ function()
35
+ return 'Hello World!'
36
+ end
37
+ )
38
+ `;
39
+
40
+ await redis.functions.load({ code, replace: true });
41
+
42
+ const res = await redis.functions.call("helloworld");
43
+ console.log(res); // "Hello World!"
44
+ ```
45
+
46
+ ```ts Advanced
47
+ const code = `
48
+ #!lua name=mylib
49
+
50
+ redis.register_function('my_hset',
51
+ function (keys, args)
52
+ local hash = keys[1]
53
+ local time = redis.call('TIME')[1]
54
+ return redis.call('HSET', hash, '_last_modified_', time, unpack(args))
55
+ end
56
+ )
57
+ `;
58
+
59
+ await redis.functions.load({ code, replace: true });
60
+
61
+ const res = await redis.functions.call(
62
+ "my_hset",
63
+ ["myhash"],
64
+ [
65
+ "myfield",
66
+ "some value",
67
+ "another_field",
68
+ "another value",
69
+ ],
70
+ );
71
+ ```
72
+ </RequestExample>
@@ -0,0 +1,57 @@
1
+ ---
2
+ title: FCALL_RO
3
+ description: Invoke a read-only function
4
+ ---
5
+
6
+ <Note>
7
+ The function must be declared with the `no-writes` flag for it to be used with `callRo`.
8
+ </Note>
9
+
10
+ ## Arguments
11
+
12
+ <ParamField body="function" type="string" required>
13
+ The function name.
14
+ </ParamField>
15
+
16
+ <ParamField body="keys" type="string[]">
17
+ The keys that the function accesses.
18
+
19
+ <Warning>
20
+ The function can only read from the keys that are provided in the `keys` argument.
21
+ </Warning>
22
+ </ParamField>
23
+
24
+ <ParamField body="args" type="string[]">
25
+ The arguments for the function.
26
+ </ParamField>
27
+
28
+ ## Response
29
+
30
+ <ResponseField type="unknown" required>
31
+ The return value of the function.
32
+ </ResponseField>
33
+
34
+ <RequestExample>
35
+ ```ts Example
36
+ const code = `
37
+ #!lua name=ro_lib
38
+
39
+ local function get_value(keys, args)
40
+ return redis.call('GET', keys[1])
41
+ end
42
+
43
+ redis.register_function({
44
+ function_name='get_value',
45
+ callback=get_value,
46
+ flags={ 'no-writes' }
47
+ })
48
+ `;
49
+
50
+ await redis.functions.load({ code, replace: true });
51
+
52
+ // Call the read-only function
53
+ // Note: We can modify the keys usage here, but since it represents a read-only operation
54
+ // and we marked it with 'no-writes', it is safe to use callRo.
55
+ const value = await redis.functions.callRo("get_value", ["mykey"])
56
+ ```
57
+ </RequestExample>
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: FUNCTION DELETE
3
+ description: Delete a library and all its functions.
4
+ ---
5
+
6
+ ## Arguments
7
+
8
+ <ParamField body="libraryName" type="string" required>
9
+ The name of the library to delete.
10
+ </ParamField>
11
+
12
+ ## Response
13
+
14
+ <ResponseField type="string" required>
15
+ "OK"
16
+ </ResponseField>
17
+
18
+ <RequestExample>
19
+ ```ts Example
20
+ await redis.functions.delete("mylib")
21
+ ```
22
+ </RequestExample>