
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
@zcatalyst/cache
Advanced tools
ZOHO CATALYST SDK for JavaScript Cache for Node.js and Browser.
To install this package, simply type add or install @zcatalyst/cache using your favorite package manager:
npm install @zcatalyst/cache
yarn add @zcatalyst/cache
pnpm add @zcatalyst/cache
The Catalyst SDK is modulized by Components.
To send a request, you only need to import the Cache
:
// ES5 example
const { Cache } = require('@zcatalyst/cache');
// ES6+ example
import { Cache } from '@zcatalyst/cache';
To send a request, you:
const cache = new Cache();
const segment = await cache.segment();
We recommend using await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const data = await segment.getValue('Age');
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.
You can also use Promise chaining to execute send operation.
segment.getValue('Age')
.then(
(data) => {
// process data.
},
(error) => {
// error handling.
}
);
Promises can also be called using .catch()
and .finally()
as follows:
segment.getValue('Age')
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
We do not recommend using callbacks because of callback hell, but they are supported by the send operation.
// callbacks.
segment.getValue('Age',
(err, data) => {
// process err and data.
}
);
When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).
try {
const data = await segment.getValue('Age');
// process data.
} catch (error) {
const message = error.message;
const status = error.statusCode;
console.log({ message, status });
}
Contributions to this library are always welcome and highly encouraged.
See CONTRIBUTING for more information on how to get started.
This SDK is distributed under the Apache License 2.0. See LICENSE file for more information.
FAQs
ZOHO CATALYST SDK for JavaScript Cache for Node.js and Browser.
The npm package @zcatalyst/cache receives a total of 2 weekly downloads. As such, @zcatalyst/cache popularity was classified as not popular.
We found that @zcatalyst/cache demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.