Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/syarul/rq-redis
- Owner: syarul
- License: apache-2.0
- Created: 2023-09-29T01:20:23.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-30T05:22:06.000Z (about 1 year ago)
- Last Synced: 2024-10-12T02:54:23.123Z (about 1 month ago)
- Language: JavaScript
- Size: 61.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)```