{"id":44862,"library":"ewd-qoper8-cache","title":"ewd-qoper8-cache","description":"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.","status":"active","version":"2.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/robtweed/ewd-qoper8-cache","tags":["javascript"],"install":[{"cmd":"npm install ewd-qoper8-cache","lang":"bash","label":"npm"},{"cmd":"yarn add ewd-qoper8-cache","lang":"bash","label":"yarn"},{"cmd":"pnpm add ewd-qoper8-cache","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core module for worker process management; ewd-qoper8-cache integrates with it.","package":"ewd-qoper8","optional":false},{"reason":"Loaded automatically to provide a JavaScript interface to Cache global storage.","package":"ewd-document-store","optional":false},{"reason":"The InterSystems Cache Node.js driver required for database connectivity.","package":"cache","optional":false}],"imports":[{"note":"EWD modules are CommonJS only; no ES module support.","symbol":"require('ewd-qoper8-cache')","correct":"const connectCacheTo = require('ewd-qoper8-cache');"},{"note":"The function must be called with the ewd-qoper8 worker context (this) as first argument.","wrong":"connectCacheTo(this, {}) without passing the worker object correctly","symbol":"connectCacheTo function","correct":"connectCacheTo(this);  // or connectCacheTo(this, params);"},{"note":"Events are emitted on the worker instance (this) after connectCacheTo initialises them.","wrong":"Using Worker.on instead of this.on","symbol":"events: dbOpened, dbClosed, DocumentStoreStarted","correct":"this.on('dbOpened', function(status) { console.log('Status:', status); });"}],"quickstart":{"code":"// Example worker module for ewd-qoper8 using ewd-qoper8-cache\n'use strict';\nconst connectCacheTo = require('ewd-qoper8-cache');\nconst params = {\n  path: process.env.CACHE_PATH || '/opt/cache/mgr',\n  username: process.env.CACHE_USER || '_SYSTEM',\n  password: process.env.CACHE_PASS || 'SYS',\n  namespace: process.env.CACHE_NAMESPACE || 'USER',\n  charset: 'UTF-8'\n};\n\nthis.on('start', function(isFirst) {\n  connectCacheTo(this, params);\n});\n\nthis.on('dbOpened', function(status) {\n  console.log('Cache opened by worker ' + process.pid + ': ' + JSON.stringify(status));\n  if (status.error) throw new Error(status.error);\n});\n\nthis.on('dbClosed', function() {\n  console.log('Cache closed for worker ' + process.pid);\n});\n\nthis.on('DocumentStoreStarted', function() {\n  console.log('DocumentStore ready for worker ' + process.pid);\n});","lang":"javascript","description":"Sets up a worker module that opens a connection to Cache with configurable parameters."},"warnings":[{"fix":"Install 'cache' via npm and ensure the Cache client binaries and environment variables are set.","message":"The cache Node.js driver ('cache') must be installed separately and configured correctly; missing or misconfigured driver causes silent failures.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Always specify a strong password in the params object and use environment variables.","message":"Default password 'SYS' is insecure in production; must be overridden via params.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Handle 'dbClosed' event to perform cleanup before the worker exits.","message":"The module calls process.exit() on 'stop' event; custom cleanup must be done in 'dbClosed' handler before that.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Ensure 'connectCacheTo' is called only once per worker lifecycle.","message":"Only one Cache connection per worker is supported; calling connectCacheTo multiple times will override previous connection.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2.2.1':16 'automat':32,71 'cach':4,7,26,43 'connect':25,76 'current':19 'customis':75 'databas':8 'dbclose':62 'dbopen':60 'differenti':64 'document':36 'documentstor':72 'ecosystem':55 'event':58 'ewd':2,11,29,35,53,69 'ewd-document-stor':34 'ewd-qoper8':10,28,52,68 'ewd-qoper8-cache':1 'global':45 'integr':5,66 'interfac':41 'intersystem':6 'javascript':40,78 'key':63 'like':59 'load':33 'modul':23 'paramet':77 'part':49 'process':14 'provid':57 'qoper8':3,12,30,54,70 'releas':21 'seamless':65 'setup':73 'simplifi':24 'stabl':20 'storag':46 'store':37 'version':15 'worker':13,31","created_at":"2026-06-07T12:52:11.663979+00:00","updated_at":"2026-06-07T12:52:11.663979+00:00","problems":[{"fix":"Run: npm install cache","cause":"The InterSystems Cache Node.js driver is not installed.","error":"Error: Cannot find module 'cache'"},{"fix":"Use const connectCacheTo = require('ewd-qoper8-cache');","cause":"Module was imported incorrectly (e.g., as default import instead of require).","error":"Error: connectCacheTo is not a function"},{"fix":"Verify Cache is running and update params.path, username, password, namespace.","cause":"Cache database is not running or path/credentials are wrong.","error":"Error: Cannot connect to Cache: Connection refused"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/robtweed/ewd-qoper8-cache#readme","github":"https://github.com/robtweed/ewd-qoper8-cache","docs":null,"changelog":null,"pypi":null,"npm":"ewd-qoper8-cache","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}