Registry / storage / prerender-memory-cache

prerender-memory-cache

JSON →
library1.0.2jsnpmunverified

A lightweight in-memory cache plugin for Prerender server, version 1.0.2. It caches rendered HTML pages in memory to avoid re-rendering the same URL repeatedly, improving performance for high-traffic sites. Configurable max cache size (default 100) and TTL (default 60 seconds). No external dependencies, integrates as a middleware. Maintenance mode with no recent updates.

npm install prerender-memory-cache
INSTALL
IMPORT
SIG · PRERENDER-MEMORY-C
P
prerender-memory-cache
storagejavascriptv1.0.2
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
require('prerender-memory-cache')
import prerenderMemoryCache from 'prerender-memory-cache'
CommonJS module; does not export an ESM default.
Prerender plugin usage
server.use(require('prerender-memory-cache'))
server.use(prerenderMemoryCache())
Plugin is used as a reference function, not invoked.
Configuration via env vars
process.env.CACHE_MAXSIZE = '1000'; process.env.CACHE_TTL = '600'
const config = { CACHE_MAXSIZE: 1000, CACHE_TTL: 600 }
No programmatic API; must set environment variables before requiring the plugin.

Sets up a Prerender server with in-memory caching middleware. The cache is enabled by default with TTL=60s and max 100 items.

const prerender = require('prerender'); const server = prerender(); server.use(require('prerender-memory-cache')); server.start();
Debug
Known issues
gotchaCache configuration must be set via environment variables BEFORE requiring the module. Setting them later has no effect.
fix
Set process.env.CACHE_MAXSIZE and process.env.CACHE_TTL before any require of prerender-memory-cache.
affects: >=1.0.0
gotchaCache does not invalidate based on external events; stale content is served until TTL expires.
fix
Set a reasonable TTL or disable cache for dynamic pages.
affects: >=1.0.0
gotchaCache stores responses in memory of a single Node process. Not suitable for multi-process or clustered deployments without a shared cache layer.
fix
Use a distributed cache like Redis for clustered environments.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'prerender-memory-cache'
Prerender not installed or npm install didn't run in the Prerender server directory.
fix
Run 'npm install prerender-memory-cache --save' from the Prerender server root.
TypeError: server.use is not a function
Using import syntax or not using Prerender's server object.
fix
Ensure you're calling server.use on a proper Prerender server instance: const server = prerender();
Cache not serving cached responses
Environment variables set after module is loaded, or TTL expired.
fix
Set CACHE_MAXSIZE and CACHE_TTL before requiring the module, or increase TTL.
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
OpenAI (training)
1
Resources
prerender-memory-cache — npm install prerender-memory-cache · libregistry