{"id":46784,"library":"warp-contracts-redis","title":"warp-contracts-redis","description":"Redis-backed SortKeyCache implementation for Warp Contracts (Arweave smart contracts). Version 0.4.2 is the latest stable release, targeting Node.js >=16.5. This package provides an online caching alternative to local caches, with a managed mode that delegates connection lifecycle to the user, solving issues with repeated open/close calls. It uses Lua scripts for atomic operations and supports prefix-based key isolation. Ships TypeScript types.","status":"active","version":"0.4.2","language":"javascript","source_language":"en","source_url":"https://github.com/firstbatchxyz/warp-contracts-redis#readme","tags":["javascript","key-value store","storage","database","blockchain","arweave","smartweave","warp-contracts","redis","typescript"],"install":[{"cmd":"npm install warp-contracts-redis","lang":"bash","label":"npm"},{"cmd":"yarn add warp-contracts-redis","lang":"bash","label":"yarn"},{"cmd":"pnpm add warp-contracts-redis","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for interacting with Redis; required at runtime.","package":"ioredis","optional":false},{"reason":"Peer dependency providing the SortKeyCache interface and core Warp types; required at runtime.","package":"warp-contracts","optional":false}],"imports":[{"note":"The package is ESM-only; does not support CommonJS require().","wrong":"const RedisCache = require('warp-contracts-redis')","symbol":"RedisCache","correct":"import { RedisCache } from 'warp-contracts-redis'"},{"note":"RedisOptions is a TypeScript type; use dedicated type import to avoid runtime inclusion.","wrong":"import { RedisOptions } from 'warp-contracts-redis'","symbol":"RedisOptions","correct":"import type { RedisOptions } from 'warp-contracts-redis'"},{"note":"CacheOptions is re-exported from warp-contracts; import directly from warp-contracts to avoid dependency confusion.","wrong":"import { CacheOptions } from 'warp-contracts-redis'","symbol":"CacheOptions","correct":"import type { CacheOptions } from 'warp-contracts'"}],"quickstart":{"code":"import { RedisCache } from 'warp-contracts-redis';\nimport type { CacheOptions } from 'warp-contracts';\nimport type { RedisOptions } from 'warp-contracts-redis';\n\nconst cacheOptions: CacheOptions = {\n  inMemory: true,\n  dbLocation: 'myapp:cache',\n  subLevelSeparator: '|'\n};\n\nconst redisOptions: RedisOptions = {\n  url: process.env.REDIS_URL ?? 'redis://localhost:6379',\n  minEntriesPerContract: 10,\n  maxEntriesPerContract: 100\n};\n\nconst cache = new RedisCache(cacheOptions, redisOptions);\n\n(async () => {\n  // Example usage\n  const contractTxId = 'contract123';\n  const sortKey = '000001';\n  await cache.put(contractTxId, sortKey, { data: 'hello' });\n  const value = await cache.get(contractTxId, sortKey);\n  console.log('Cached value:', value);\n})();","lang":"typescript","description":"Creates a Redis-backed SortKeyCache, writes and reads a value using the contract TX ID and sort key."},"warnings":[{"fix":"Use import or dynamic import().","message":"The package is ESM-only; do not use require().","severity":"breaking","affected_versions":">=0.4.0"},{"fix":"Connect the client before passing it to RedisCache; do not rely on cache.open() or cache.close().","message":"When using managed mode (passing a custom Redis client), open() and close() are disabled. User must manage connection lifecycle.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Set inMemory: true in cacheOptions.","message":"CacheOptions.inMemory must be true for RedisCache to work correctly (dumping on close is not supported).","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Import type { CacheOptions } from 'warp-contracts'.","message":"Direct import of CacheOptions from warp-contracts-redis is deprecated; import from warp-contracts instead.","severity":"deprecated","affected_versions":">=0.4.0"}],"env_vars":null,"search_vec":"'0.4.2':17 '16.5':25 'altern':32 'arweav':13,78 'atom':58 'back':7 'base':64 'blockchain':77 'cach':31,35 'call':52 'connect':42 'contract':3,12,15,82 'databas':76 'deleg':41 'implement':9 'isol':66 'issu':48 'javascript':70 'key':65,72 'key-valu':71 'latest':20 'lifecycl':43 'local':34 'lua':55 'manag':38 'mode':39 'node.js':24 'onlin':30 'open/close':51 'oper':59 'packag':27 'prefix':63 'prefix-bas':62 'provid':28 'redi':4,6,83 'redis-back':5 'releas':22 'repeat':50 'script':56 'ship':67 'smart':14 'smartweav':79 'solv':47 'sortkeycach':8 'stabl':21 'storag':75 'store':74 'support':61 'target':23 'type':69 'typescript':68,84 'use':54 'user':46 'valu':73 'version':16 'warp':2,11,81 'warp-contract':80 'warp-contracts-redi':1","created_at":"2026-06-07T13:01:36.863226+00:00","updated_at":"2026-06-07T13:01:36.863226+00:00","problems":[{"fix":"Run 'npm install warp-contracts-redis ioredis warp-contracts'. Ensure Node >=16.5 and project uses ESM (type: module in package.json).","cause":"Package not installed or ESM/CJS mismatch in Node.js version may cause resolution failure.","error":"Cannot find module 'warp-contracts-redis'"},{"fix":"Change to import { RedisCache } from 'warp-contracts-redis' and ensure project is ESM.","cause":"Using require() on an ESM-only package.","error":"TypeError: RedisCache is not a constructor"},{"fix":"Ensure both options are positive integers.","cause":"Passing non-integer values for minEntriesPerContract or maxEntriesPerContract.","error":"Error: ERR value is not an integer or out of range"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/firstbatchxyz/warp-contracts-redis#readme","github":"https://github.com/firstbatchxyz/warp-contracts-redis#readme","docs":null,"changelog":null,"pypi":null,"npm":"warp-contracts-redis","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage","database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}