Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs Object Document Model for Redis

I'm want use an ODM for redis in node.js. Does anybody have any experience using any? I ideally want something that is somewhat the equivalent of mongoose (except instead for Redis instead of Mongodb).

The two I have heard of so far are nohm and ron. Can someone compare the experience of using either of these? Also I have read about redback and I am curious if it would work well with an ODM.

like image 207
GTDev Avatar asked Apr 30 '12 16:04

GTDev


People also ask

How Redis works with NodeJS?

Redis, an in-memory database that stores data in the server memory, is a popular tool to cache data. You can connect to Redis in Node. js using the node-redis module, which gives you methods to retrieve and store data in Redis.

How do I connect to a node js server in Redis?

Use a connection string to your remote Redis DB to connect to a different host or port. The connect() method is used to connect the NodeJS to the Redis Server. This return promise that's why we have to handle it either using the then and catch or using the sync and await keyword. (async () => { await redisclient.

How set Redis value in node JS?

js file in the root directory and put the following code inside: const redis = require('redis'); const client = redis. createClient(); const axios = require('axios'); const express = require('express'); const app = express(); const USERS_API = 'https://jsonplaceholder.typicode.com/users/'; app.

What is Ioredis?

ioredis is a robust, full-featured Redis client that is used in the world's biggest online commerce company Alibaba and many other awesome companies. Full-featured. It supports Cluster, Sentinel, Streams, Pipelining, and of course Lua scripting, Redis Functions, Pub/Sub (with the support of binary messages).


1 Answers

Redis is pretty simple to work with directly or to wrap your own objects around, but you could use an OHM (Object Hash Mapper) like Nohm:

  • source: https://github.com/maritz/nohm
  • documentation: http://maritz.github.com/nohm/
like image 103
phlipper Avatar answered Oct 06 '22 10:10

phlipper