Registry / database / parse-cache-memory

parse-cache-memory

JSON →
library2.1.0jsnpmunverified

In-memory caching layer for Parse Server queries using LRU cache. Current version: 2.1.0. Provides drop-in cache methods (findCache, getCache, countCache, etc.) that replace standard Parse Query calls. Key differentiators: automatic cache invalidation on data mutations, configurable TTL and size, built-in debug mode, and cache statistics tracking. Lightweight without external cache dependencies.

database
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.

CommonJS only; no default export. Must destructure or access as property of require.

const { parseCacheInit } = require('parse-cache-memory');

Export available starting from v2? Not documented. Use parseCacheInit function instead.

const { ParseCache } = require('parse-cache-memory');

Correct option name is 'max' not 'maxItems' or 'maxSize' (though maxSize is also accepted). Options are passed as object.

const { parseCacheInit } = require('parse-cache-memory'); parseCacheInit({ max: 500, ttl: 60000 });

Initializes the cache with custom options and demonstrates a basic cached query using findCache().

const { parseCacheInit } = require('parse-cache-memory'); const Parse = require('parse/node'); // Initialize Parse server Parse.initialize('appId', 'jsKey', 'masterKey'); Parse.serverURL = 'http://localhost:1337/parse'; // Initialize cache with custom options parseCacheInit({ max: 1000, ttl: 1000 * 60 * 10, // 10 minutes allowStale: false, updateAgeOnGet: true, resetCacheOnSaveAndDestroy: false, debug: false }); // Use cache methods async function example() { const query = new Parse.Query('GameScore'); query.equalTo('playerName', 'Dan Stemkoski'); const results = await query.findCache({ useMasterKey: true }); console.log('Results from cache:', results); }
Debug
Known footguns
breakingparseCacheInit must be called before using any cache methods; otherwise methods will throw 'ParseCache is not defined'.
gotchaCached methods (e.g., findCache) do not support all Parse Query options like subqueries or include pointers; behavior may be inconsistent.
gotchaCache is in-memory only; restarting the server clears all cached data.
deprecatedOption 'maxSize' is deprecated in favor of 'max' to match underlying lru-cache API.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
3
ahrefsbot
1
Resources