think-cache is a caching middleware for ThinkJS 3.x, version 1.1.2, providing in-memory and file-based caching with a simple API. It integrates seamlessly with ThinkJS controllers and services, leveraging ES6+ features and TypeScript types. Released on a maintenance cycle, it is not actively developed and deprecated in favor of newer caching solutions like lru-cache or node-cache. Differentiators include its tight coupling with ThinkJS's ecosystem and trivial setup for rapid prototyping.
npm install think-cacheNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates creating a file-based cache instance, setting and getting a value, then removing it.
Replace with lru-cache or node-cache.
Update all cache calls to use async/await or Promises.
Set proper write permissions or switch to memory cache.
Use a centralized caching solution like Redis for clustered environments.
Run npm install think-cache and ensure you are using ESM imports.
Use await (new Cache()).get(...) or ensure you await the initialization.
Replace const cache = require('think-cache') with import cache from 'think-cache'.