Registry / database / cache-grpc-server

cache-grpc-server

JSON →
library0.2.1jsnpmunverified

A gRPC-based cache server using Redis as storage, designed for high-speed get/set operations via streaming connections. Version 0.2.1 provides ready-to-use Docker images, reflection support, health probes (gRPC health.v1), and TLS/mTLS configurations. The library can also be embedded as a NestJS module with a custom storage strategy (StorageStrategyInterface). It uses streaming RPCs for efficient communication and is suitable for Kubernetes deployments with grpc_health_probe. Compatible with Node.js and TypeScript.

npm install cache-grpc-server
INSTALL
IMPORT
SIG · CACHE-GRPC-SERVER
C
cache-grpc-server
databasejavascriptv0.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.

AppModule
✓ import { AppModule } from 'cache-grpc-server'
✗ const AppModule = require('cache-grpc-server').AppModule
ESM-only; named export. AppModule.register() used for custom storage.
SetRequestInterface
✓ import { SetRequestInterface } from 'cache-grpc-server'
Named export for custom storage implementation.
StorageStrategyInterface
✓ import { StorageStrategyInterface } from 'cache-grpc-server'
✗ import { StorageStrategy } from 'cache-grpc-server'
Interface not class; name differs from common expectation.
GrpcClientOptions
✓ import { GrpcClientOptions } from 'cache-grpc-server'
Used to obtain gRPC client options for microservice connection.

Minimal NestJS bootstrap with custom storage strategy replacing Redis backend.

// Use as a library: custom storage example import { NestFactory } from '@nestjs/core'; import { AppModule, SetRequestInterface, StorageStrategyInterface, GrpcClientOptions } from 'cache-grpc-server'; import { MicroserviceOptions } from '@nestjs/microservices'; import { Injectable } from '@nestjs/common'; @Injectable() class CustomStorageStrategy implements StorageStrategyInterface { async existsMulti(keys: string[]): Promise<boolean[]> { return keys.map(() => true); } async getMulti(keys: string[]): Promise<string[]> { return keys.map(k => `value_${k}`); } async save(data: SetRequestInterface): Promise<string> { return data.key; } } async function bootstrap() { const app = await NestFactory.create(AppModule.register(CustomStorageStrategy)); const grpcClientOptions = app.get(GrpcClientOptions); app.connectMicroservice<MicroserviceOptions>(grpcClientOptions.getOptions()); await app.startAllMicroservices(); await app.init(); return app; } bootstrap().then(() => console.log('Server started')).catch(err => console.error(err));
Debug
Known issues
gotchaThe package is pre-1.0 (v0.2.1); breaking changes may occur. API stability is not guaranteed.
fix
Pin to exact version and test upgrades thoroughly.
affects: >=0.0.0
gotchaStorageStrategyInterface is required; omitting it when using AppModule.register will cause runtime errors.
fix
Always provide a class implementing StorageStrategyInterface to AppModule.register().
affects: >=0.2.0
deprecatedThe environment variable 'REDIS_URL' uses '127.0.0.1:6379' format (without 'redis://'). This may be deprecated in future for URI format.
fix
Use 'redis://127.0.0.1:6379' to align with ioredis standards.
affects: >=0.1.0
gotchaTLS-related env vars (TLS_INSECURE, TLS_KEY_PATH, etc.) are commented out in .env. Enabling them without proper certificate files will crash the server.
fix
Ensure TLS files exist at specified paths or set TLS_INSECURE=false cautiously.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'cache-grpc-server'
Package not installed or wrong import path
fix
Run 'npm install cache-grpc-server' and ensure import is correct: 'import { ... } from 'cache-grpc-server'
TypeError: AppModule.register is not a function
Using default import instead of named import or incorrect version
fix
Use named import: import { AppModule } from 'cache-grpc-server'
error: [tls] option.secureContext is an invalid argument
Misconfigured TLS environment variables without valid key/cert files
fix
Set TLS_INSECURE=true for development or provide correct paths to TLS files.
Upgrade
Version history
0.2.1latest on npm
Audit
Dependencies
@grpc/grpc-jsrequiredgRPC core client/server library used for streaming RPCs and reflection
ioredisrequiredRedis client used as the default storage backend
@nestjs/coreoptionalNestJS framework dependency for modularity and microservice support
Agent activity
16 hits · last 30 days
node
14
OpenAI (training)
1
Resources
cache-grpc-server — npm install cache-grpc-server · libregistry