Registry / database / ewd-qoper8-cache

ewd-qoper8-cache

JSON →
library2.2.1jsnpmunverified

Integrates InterSystems Cache database with ewd-qoper8 worker processes. Version 2.2.1 is the current stable release. This module simplifies connecting Cache to ewd-qoper8 workers, automatically loading ewd-document-store for a JavaScript interface to Cache's global storage. It is part of the ewd-qoper8 ecosystem and provides events like dbOpened and dbClosed. Key differentiators: seamless integration with ewd-qoper8, automatic DocumentStore setup, and customisable connection parameters.

npm install ewd-qoper8-cache
INSTALL
IMPORT
SIG · EWD-QOPER8-CACHE
E
ewd-qoper8-cache
databasejavascriptv2.2.1
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.

require('ewd-qoper8-cache')
✓ const connectCacheTo = require('ewd-qoper8-cache');
EWD modules are CommonJS only; no ES module support.
connectCacheTo function
✓ connectCacheTo(this); // or connectCacheTo(this, params);
✗ connectCacheTo(this, {}) without passing the worker object correctly
The function must be called with the ewd-qoper8 worker context (this) as first argument.
events: dbOpened, dbClosed, DocumentStoreStarted
✓ this.on('dbOpened', function(status) { console.log('Status:', status); });
✗ Using Worker.on instead of this.on
Events are emitted on the worker instance (this) after connectCacheTo initialises them.

Sets up a worker module that opens a connection to Cache with configurable parameters.

// Example worker module for ewd-qoper8 using ewd-qoper8-cache 'use strict'; const connectCacheTo = require('ewd-qoper8-cache'); const params = { path: process.env.CACHE_PATH || '/opt/cache/mgr', username: process.env.CACHE_USER || '_SYSTEM', password: process.env.CACHE_PASS || 'SYS', namespace: process.env.CACHE_NAMESPACE || 'USER', charset: 'UTF-8' }; this.on('start', function(isFirst) { connectCacheTo(this, params); }); this.on('dbOpened', function(status) { console.log('Cache opened by worker ' + process.pid + ': ' + JSON.stringify(status)); if (status.error) throw new Error(status.error); }); this.on('dbClosed', function() { console.log('Cache closed for worker ' + process.pid); }); this.on('DocumentStoreStarted', function() { console.log('DocumentStore ready for worker ' + process.pid); });
Debug
Known issues
gotchaThe cache Node.js driver ('cache') must be installed separately and configured correctly; missing or misconfigured driver causes silent failures.
fix
Install 'cache' via npm and ensure the Cache client binaries and environment variables are set.
affects: >=0.0.0
gotchaDefault password 'SYS' is insecure in production; must be overridden via params.
fix
Always specify a strong password in the params object and use environment variables.
affects: >=0.0.0
gotchaThe module calls process.exit() on 'stop' event; custom cleanup must be done in 'dbClosed' handler before that.
fix
Handle 'dbClosed' event to perform cleanup before the worker exits.
affects: >=0.0.0
gotchaOnly one Cache connection per worker is supported; calling connectCacheTo multiple times will override previous connection.
fix
Ensure 'connectCacheTo' is called only once per worker lifecycle.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cache'
The InterSystems Cache Node.js driver is not installed.
fix
Run: npm install cache
Error: connectCacheTo is not a function
Module was imported incorrectly (e.g., as default import instead of require).
fix
Use const connectCacheTo = require('ewd-qoper8-cache');
Error: Cannot connect to Cache: Connection refused
Cache database is not running or path/credentials are wrong.
fix
Verify Cache is running and update params.path, username, password, namespace.
Upgrade
Version history
2.2.1latest on npm
Audit
Dependencies
ewd-qoper8requiredCore module for worker process management; ewd-qoper8-cache integrates with it.
ewd-document-storerequiredLoaded automatically to provide a JavaScript interface to Cache global storage.
cacherequiredThe InterSystems Cache Node.js driver required for database connectivity.
Agent activity
9 hits · last 30 days
node
8
Resources
ewd-qoper8-cache — npm install ewd-qoper8-cache · libregistry