This project provides a simple setup for using the Keyv
library with Redis
or an in-memory store, depending on the environment (production or local development).
- Redis as a store: In production, the store uses Redis for caching or storing data.
- In-memory store: In local development, it can default to an in-memory store if Redis is not available.
-
Environment variable checks: The project uses
@nitra/check-env
to ensure necessary environment variables are defined. - Error handling: Any connection errors are logged using an event listener.
- Node.js
- Redis (for production)
To install the library, run:
yarn add @nitra/keyv
# or
npm install @nitra/keyv
Set the Redis connection string and namespace in the environment variables:
REDIS_CONN=redis://user:password@localhost:6379
KEYV_NAMESPACE=your-namespace