orbis-cache
v1.0.4
Published
Orbis Client SDK
Readme
orbis-cache
The official, lightweight Node.js client SDK for the Orbis distributed caching engine.
This package allows your Node.js, Express, or Next.js applications to seamlessly communicate with your Orbis cluster, set cache keys, and retrieve them with zero friction.
Installation
npm install orbis-cacheQuick Start
const { OrbisClient } = require('orbis-cache');
// Connect to your local Orbis coordinator
const cache = new OrbisClient({ port: 4000 });
async function fetchUser(userId) {
// 1. Check cache first
const cachedUser = await cache.get(`user:${userId}`);
if (cachedUser) {
return cachedUser;
}
// 2. Fetch from your database if cache misses
const dbUser = { id: userId, name: "Aman Singh" }; // Simulated DB call
// 3. Store in cache for 5 minutes (300 seconds)
await cache.set(`user:${userId}`, dbUser, 300);
return dbUser;
}Authentication
If your Orbis cluster is secured with an --auth-key, pass it during initialization:
const cache = new OrbisClient({
port: 4000,
authKey: 'supersecret'
});Learn More
For the full architecture documentation, server setup guides, and multi-language REST support, visit the main Orbis GitHub Repository.
