@screeny05/unstorage-driver-redis
v1.0.0
Published
Slightly modified Redis driver for unstorage
Downloads
8
Readme
@screeny05/unstorage-driver-redis
Provides an unstorage driver which uses ioredis to store data.
This code is extracted from the official unstorage driver for Redis with some slight modifications added:
- Support for setItems natively, running
msetand a pipeline forexpirefor better performance
Installation
# Using pnpm
pnpm add @screeny05/unstorage-driver-redis
# Using yarn
yarn add @screeny05/unstorage-driver-redis
# Using npm
npm install @screeny05/unstorage-driver-redisUsage
import { createStorage } from 'unstorage';
import redisStorage from '@screeny05/unstorage-driver-redis';
const storage = createStorage({
driver: redisStorage(),
});Nitro configuration:
export default defineNitroConfig({
storage: {
cache: {
driver: '@screeny05/unstorage-driver-redis',
},
},
});Nuxt configuration:
export default defineNuxtConfig({
nitro: {
storage: {
cache: {
driver: '@screeny05/unstorage-driver-redis',
},
},
},
});Configuration
This package supports the same configuration options as the official Redis driver.
export default defineNuxtConfig({
nitro: {
storage: {
cache: {
url: 'redis://localhost:6379',
driver: '@screeny05/unstorage-driver-redis',
enableAutoPipelining: true,
preConnect: true,
},
},
},
});