Registry / database / parse-cache

parse-cache

JSON →
library0.0.13jsnpmunverified

A caching wrapper for Parse SDK queries, supporting both memory and Redis storage. Version 0.0.13 is the latest and likely final release; the project appears unmaintained since 2021. Works with Node.js (cloud code) and browsers. Provides a simple .cache() method on queries with TTL support. Alternative to manual caching or parse-server built-in cache. Requires parse-server ≥2.8.4 and Parse SDK ≥2.1.

npm install parse-cache
INSTALL
IMPORT
SIG · PARSE-CACHE
P
parse-cache
databasejavascriptv0.0.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const parseCache = require('parse-cache');
import parseCache from 'parse-cache';
This package has no ESM entry; use CommonJS require. Not tested with import.
cache method
query.cache(ttlSeconds, customKey?)
Attached to Parse.Query prototype after calling parseCache(Parse, ...). Must be called before find/first/count/etc.
Browser script
<script src='https://unpkg.com/parse-cache/dist/parse-cache.js'></script>
Global variable `parseCache` is exposed. Works with Parse JS SDK.

Initializes parse-cache with memory storage, then runs a cached query showing the fromCache flag.

const Parse = require('parse/node'); const parseCache = require('parse-cache'); // Enable caching with memory store (default) parseCache(Parse, 'MyApp', { engine: 'memory', count: 1000 }); const query = new Parse.Query('GameScore'); query.cache(30); // cache for 30 seconds query.equalTo('playerName', 'John'); query.find().then(results => { console.log('fromCache:', results[0].fromCache); }).catch(console.error);
Debug
Known issues
gotchaparseCache() must be called before any query that uses .cache(). Otherwise .cache() is undefined.
fix
Ensure parseCache(Parse, ...) is called once at app startup before any query execution.
affects: >=0.0.0
breakingThis package overrides Parse.Query prototype methods. May conflict with other plugins or future Parse SDK updates.
fix
Test compatibility with exact Parse SDK version. Avoid using with other caching libraries.
affects: >=0.0.0
deprecatedNot actively maintained. Last release 2021. No ESM support. No TypeScript definitions.
fix
Consider alternatives like parse-server built-in cache or custom caching.
affects: >=0.0.0
gotchaRedis engine requires the 'redis' npm package installed separately. parse-cache does not list it as a dependency.
fix
Run 'npm install redis' alongside parse-cache.
affects: >=0.0.0
Errors
Common errors & fixes
query.cache is not a function
parseCache() was not called before creating queries, or called with wrong arguments.
fix
Call parseCache(Parse, 'AppName', {engine: 'memory'}) at the beginning of your script.
Cannot find module 'redis'
Using Redis engine without installing the 'redis' package.
fix
npm install redis
fromCache is undefined on results
Query was retrieved from server (not cached) or cache was invalidated.
fix
Run the same query twice; only the second call has fromCache set to true.
Upgrade
Version history
0.0.13latest on npm
Audit
Dependencies
parserequiredPeer dependency: works with Parse Node SDK or Parse JS SDK
redisoptionalRequired only when using Redis engine
Agent activity
10 hits · last 30 days
node
8
Resources
parse-cache — npm install parse-cache · libregistry