Installation
Prerequisites
- Node.js ≥ 18
- Redis ≥ 6
Install the package
Install redis-graph-cache using your preferred package manager:
npm
npm install redis-graph-cache ioredisyarn
yarn add redis-graph-cache ioredispnpm
pnpm add redis-graph-cache ioredisbun
bun add redis-graph-cache ioredisImportant: ioredis is a peer dependency
ioredis is a peer dependency and is installed automatically. If you already use ioredis in your app, your existing version is reused (must be ^5.0.0).
TypeScript types
The package includes built-in TypeScript types. No additional type installation is required.
import { RedisGraphCache } from 'redis-graph-cache';
const cache = new RedisGraphCache(schema, {
redis: { host: 'localhost', port: 6379 },
// Full TypeScript support with autocomplete
});Verify installation
After installation, you can verify that everything is working correctly by running a simple test:
import { RedisGraphCache } from 'redis-graph-cache';
const schema = {
test: {
type: 'entity' as const,
id: 'id',
key: (id: string) => `test:${id}`,
fields: { name: { type: 'string' as const } },
},
};
const cache = new RedisGraphCache(schema, {
redis: { host: 'localhost', port: 6379 },
});
console.log('Redis Graph Cache installed successfully!');
await cache.disconnect();Development dependencies
If you're developing with TypeScript, you may want to install type definitions for ioredis:
npm install --save-dev @types/ioredisInstallation complete!
You're ready to start using redis-graph-cache in your project.
Next steps
Now that you have redis-graph-cache installed, you can:
- Read the Quick Start guide to get up and running in 60 seconds
- Learn about Core Concepts to understand how the library works
- Explore Schema Design to define your data model