{"id":45638,"library":"o-redis","title":"o-redis","description":"o-redis is an automatic Redis cache update library that simplifies cache invalidation and synchronization. Version 1.0.33 is the latest stable release, with active development on GitHub. It provides a declarative API for defining cache dependencies and automatically updates caches when underlying data changes, reducing boilerplate. Unlike traditional caching libraries that require manual cache management, o-redis handles cache updates transparently, ideal for Node.js apps with Redis backends. Release cadence is irregular, focused on bug fixes and minor features.","status":"active","version":"1.0.33","language":"javascript","source_language":"en","source_url":"https://github.com/Project-Oblio/o-redis","tags":["javascript"],"install":[{"cmd":"npm install o-redis","lang":"bash","label":"npm"},{"cmd":"yarn add o-redis","lang":"bash","label":"yarn"},{"cmd":"pnpm add o-redis","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"o-redis requires the Redis client to connect and interact with Redis server.","package":"redis","optional":false}],"imports":[{"note":"Default ESM import; avoid CommonJS require unless using older Node versions.","wrong":"const oRedis = require('o-redis')","symbol":"oRedis","correct":"import oRedis from 'o-redis'"},{"note":"Named export for type checking; no subpath imports supported.","wrong":"import { CacheEntry } from 'o-redis/cache-entry'","symbol":"CacheEntry","correct":"import { CacheEntry } from 'o-redis'"},{"note":"Factory function to create a cached resource; requires redis client instance.","wrong":null,"symbol":"createCache","correct":"import { createCache } from 'o-redis'"}],"quickstart":{"code":"import { createClient } from 'redis';\nimport oRedis from 'o-redis';\n\nasync function main() {\n  const client = createClient();\n  await client.connect();\n  const cache = await oRedis(client, { prefix: 'myapp:' });\n  const key = 'user:123';\n  await cache.set(key, { name: 'Alice' }, 3600);\n  const value = await cache.get(key);\n  console.log(value); // { name: 'Alice' }\n  await client.quit();\n}\nmain().catch(console.error);","lang":"typescript","description":"Connects to Redis, initializes o-redis, sets and retrieves a cached object with TTL of 3600 seconds."},"warnings":[{"fix":"Use 'redis' v4.0.0 or later: npm install redis@latest","message":"The 'redis' client must be v4+; o-redis does not support legacy redis v3 callbacks.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Migrate to o-redis v1.x: replace package name and update imports.","message":"Before v0.5.0, o-redis was named 'o-cache' with different API. Projects on older versions will break.","severity":"breaking","affected_versions":"<0.5.0"},{"fix":"Replace autoUpdate() calls with updateOnDependency().","message":"The 'autoUpdate' method is deprecated in favor of 'cache.updateOnDependency'.","severity":"deprecated","affected_versions":">=1.0.0 <1.1.0"},{"fix":"Always provide a TTL in seconds to set() for production use.","message":"Calling set() without TTL will default to infinite cache, which may cause memory issues.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.33':21 'activ':28 'api':36 'app':70 'automat':9,42 'backend':73 'boilerpl':50 'bug':80 'cach':11,16,39,44,53,58,64 'cadenc':75 'chang':48 'data':47 'declar':35 'defin':38 'depend':40 'develop':29 'featur':84 'fix':81 'focus':78 'github':31 'handl':63 'ideal':67 'invalid':17 'irregular':77 'javascript':85 'latest':24 'librari':13,54 'manag':59 'manual':57 'minor':83 'node.js':69 'o':2,5,61 'o-redi':1,4,60 'provid':33 'redi':3,6,10,62,72 'reduc':49 'releas':26,74 'requir':56 'simplifi':15 'stabl':25 'synchron':19 'tradit':52 'transpar':66 'under':46 'unlik':51 'updat':12,43,65 'version':20","created_at":"2026-06-07T12:55:59.543933+00:00","updated_at":"2026-06-07T12:55:59.543933+00:00","problems":[{"fix":"Update to redis v4+ and use client.connect() before passing to o-redis.","cause":"Using redis v3 client which does not have a connect() method.","error":"TypeError: client.connect is not a function"},{"fix":"Ensure Redis client is connected and passed to oRedis() as the first argument.","cause":"o-redis internal pipeline fails if Redis client is not connected or provided correctly.","error":"Error: Auto update failed: cannot read property 'pipeline' of undefined"},{"fix":"Update to o-redis@1.0.11 or later: npm install o-redis@latest","cause":"Earlier versions had a bug where TTL was not serialized correctly in v1.0.0-1.0.10.","error":"ERR wrong number of arguments for 'SET' command"}],"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/Project-Oblio/o-redis#readme","github":"https://github.com/Project-Oblio/o-redis","docs":null,"changelog":null,"pypi":null,"npm":"o-redis","openapi_spec":null,"status_page":null,"smithery":null,"categories":["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}}