Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/syarul/rq-redis

requrse middleware plugins for redis
https://github.com/syarul/rq-redis

Last synced: 3 days ago
JSON representation

requrse middleware plugins for redis

Awesome Lists containing this project

README

        

# rq-redis
reQurse middleware plugin for redis.

## usage
methods:-
- get
- find
- create
- update
- getMemberKeys
- remove

```js
const rqRedis = require('rq-redis')
const rq = require('requrse')
const Redis = require('ioredis')
require('dotenv').config()

const redis = new Redis(`rediss://default:${process.env.REDIS_KEY}@willing-cowbird-38871.upstash.io:38871`)

const redisKey = 'books'
const memberKey = 'books_ids'

const modelOptions = {
rq, redis, redisKey, memberKey, options: {
methods: {}, // new methods
config: {} // new config
}
}

rqRedis({
book: {
create: {
$params: {
data: {
title: 'Foundation',
genre: 'Science Fiction'
},
title: 1 // this will be used as secondary key
},
title: 1
}
}
}, modelOptions).then(r => {
console.log(r) // { book: { create: { title: 'Foundation' } } }
redis.disconnect()
}, console.error)

```