{"id":44525,"library":"cachios","title":"Cachios","description":"Cachios is a lightweight wrapper around axios that adds in-memory caching using node-cache. Version 4.0.0 is the current stable release. It provides a simple drop-in replacement for axios with minimal configuration, caching responses by default and offering TTL control, force refresh, and custom cache backends. Unlike other caching libraries, it uses a trimmed cache (status and data) and integrates seamlessly with existing axios instances. Release cadence is low (major version bumps infrequent).","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/AlbinoDrought/cachios","tags":["javascript","axios","cache","typescript"],"install":[{"cmd":"npm install cachios","lang":"bash","label":"npm"},{"cmd":"yarn add cachios","lang":"bash","label":"yarn"},{"cmd":"pnpm add cachios","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Cachios wraps axios and is a direct dependency (not peer, but required at runtime).","package":"axios","optional":false},{"reason":"Used internally as the default cache store.","package":"node-cache","optional":true}],"imports":[{"note":"ESM default import; works in TypeScript with esModuleInterop.","wrong":"const cachios = require('cachios')","symbol":"cachios","correct":"import cachios from 'cachios'"},{"note":"Named export for creating a custom instance.","wrong":"const { create } = require('cachios')","symbol":"create","correct":"import { create } from 'cachios'"},{"note":"TypeScript type export for instance variables.","wrong":"import { CachiosInstance } from 'cachios'","symbol":"CachiosInstance","correct":"import type { CachiosInstance } from 'cachios'"}],"quickstart":{"code":"import cachios from 'cachios';\n\nasync function getPost(id: number) {\n  const response = await cachios.get(`https://jsonplaceholder.typicode.com/posts/${id}`, {\n    ttl: 60, // cache for 60 seconds\n  });\n  return response.data;\n}\n\n// First call - fetches from API\nconst data1 = await getPost(1);\nconsole.log('First call:', data1);\n\n// Second call within 60s - returns cached data\nconst data2 = await getPost(1);\nconsole.log('Second call (cached):', data2);\n\n// Force refresh\nconst data3 = await cachios.get(`https://jsonplaceholder.typicode.com/posts/1`, {\n  force: true,\n});\nconsole.log('Force refresh:', data3.data);","lang":"typescript","description":"Demonstrates basic caching with TTL, automatic cache hit, and force refresh with TypeScript."},"warnings":[{"fix":"Set a custom responseCopier option on cachios.create to include additional fields.","message":"Only response.data and response.status are cached by default. Other fields like headers are not preserved unless custom response copier is used.","severity":"gotcha","affected_versions":">=4.0.0"},{"fix":"Use cachios.create(axiosInstance) to get a custom instance, or use the default export.","message":"The cachios instance no longer extends axios directly; it exports an axios-like object. In v3, cachios was a direct axios wrapper with all axios methods; v4 changed the instance structure.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Switch to import syntax: import cachios from 'cachios'.","message":"Cachios v3 and earlier required CommonJS require; v4 is ESM-first. Using require() may cause issues with TypeScript or bundlers.","severity":"deprecated","affected_versions":"<4.0.0"}],"env_vars":null,"search_vec":"'4.0.0':20 'add':10 'around':7 'axio':8,35,70,81 'backend':52 'bump':78 'cach':14,18,39,51,55,61,82 'cachio':1,2 'cadenc':73 'configur':38 'control':46 'current':23 'custom':50 'data':64 'default':42 'drop':31 'drop-in':30 'exist':69 'forc':47 'in-memori':11 'infrequ':79 'instanc':71 'integr':66 'javascript':80 'librari':56 'lightweight':5 'low':75 'major':76 'memori':13 'minim':37 'node':17 'node-cach':16 'offer':44 'provid':27 'refresh':48 'releas':25,72 'replac':33 'respons':40 'seamless':67 'simpl':29 'stabl':24 'status':62 'trim':60 'ttl':45 'typescript':83 'unlik':53 'use':15,58 'version':19,77 'wrapper':6","created_at":"2026-06-07T12:50:33.679410+00:00","updated_at":"2026-06-07T12:50:33.679410+00:00","problems":[{"fix":"Install with 'npm install cachios' and ensure you are using ESM (e.g., type: 'module' in package.json) or use dynamic import.","cause":"Package not installed or used in a CommonJS file without proper bundler configuration.","error":"Cannot find module 'cachios'"},{"fix":"Use import cachios from 'cachios' (default export) or const instance = cachios.create(axios); then instance.get(...).","cause":"Using the default import incorrectly or creating an instance without calling create.","error":"TypeError: cachios.get is not a function"},{"fix":"Ensure you are not overriding the cache key manually; if using custom cache store, implement get/set correctly.","cause":"Using a custom cache that expects different key format, or the internal cache failed to parse.","error":"Error: Unknown cache key format"}],"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/AlbinoDrought/cachios#readme","github":"https://github.com/AlbinoDrought/cachios","docs":null,"changelog":null,"pypi":null,"npm":"cachios","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"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}}