Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to connect to redis with pomelo

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Today, the editor to share with you is how to use pomelo to connect redis, many people do not understand, today, in order to let you know more about the method of connecting pomelo to redis, so to sum up the following content, let's look down together. I'm sure you'll get something.

How pomelo connects to redis:

1. Add code to app.js

Var redis = require ("redis"); var client = redis.createClient (6379, "127.0.0.1", {}); / / Connect client.on ("error", function (err) {/ / bind redis database error callback console.error ("Redis:Error:" + err);}); app.set ("redis", client); / / app provider

2. Add code to GoodsService.js

Var redis= app.get ("redis"); / / get the redis object redis.set ("name", "caoshanshan", function (err, rep) {/ / insert data console.log ("Redis:" + rep); / / callback})

3. Testing

View redis data with redisclient-win32.x86.1.0

4. Disable redis,pomelo to display error message (bind at app.js)

On how to use pomelo to connect redis to share here, of course, not only the above and everyone's analysis, but the editor can ensure that its accuracy is absolutely no problem. I hope that the above content can have a certain reference value for everyone, and can be put into practice. If you like this article, you might as well share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report