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 use NoSql Database in nodejs

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article is about how to use NoSql database in nodejs. Xiaobian thinks it is very practical, so share it with everyone to learn. I hope you can gain something after reading this article. Let's not say much. Let's take a look at it together with Xiaobian.

Content index (non-relational database)

redis development (memory type)

Memcached(memory type)

MongoDb(Storage)

Memory type: fast reading speed, small capacity Storage type: slow reading speed, large stock

NoSQL main application scenarios

Designed to deal with high-concurrency scenarios requiring high-speed reads and writes, redis has excellent performance, can support tens of thousands of read/write operations per second, and its performance far exceeds that of databases, and also supports cluster, distributed, master-slave synchronization and other configurations;

Tmall double 11

Grab red envelopes, grab train tickets

ssr server-side rendering

redis

content index

characteristics

api

Combined with nodejs applications

characteristics

Storage structure special-dictionary

Memory Storage and Persistence-Cache

feature-rich

Simple and stable-simple and reliable

storage structure

Redis is short for REmote dictionary server, which is stored as a dictionary structure;

Dictionary is the object in js can be set operations such as intersection, union, etc., the key type in js can only be string, if it is other types, the default is toString operation;

Like most language dictionaries, Redis keys can be other data types besides strings;

string

hash

list

set

ordered set

Memory Storage and Persistence

All the data in redis database is stored in memory. An ordinary laptop computer can read and write more than 100,000 key-value pairs in one second. However, the data is stored in memory, and the program exits, resulting in data loss. However, redis also provides support for data persistence.

feature-rich

cache

Queue system (high concurrency)

Redis can set the lifetime for each key, and it will be deleted automatically when it expires. This feature, together with excellent performance, allows it to be used as a cache system;

As a cache system, redis can also limit the maximum space occupied by data, and automatically delete unnecessary keys after exceeding it.

Redis list type keys can also be used to implement queues and support blocking reads, making it easy to implement a high-performance priority queue;

Redis also supports "subscribe/publish", so it can be used to build chat rooms;

simple and stable

The intuitive storage structure of redis makes it very simple to interact with redis through programs, and use commands to read and write data in redis; command statements to redis are equivalent to sql statements and relational databases;

The source code is only more than 30,000 lines, which can be customized.

The above is how to use NoSql database in nodejs, Xiaobian believes that some knowledge points may be seen or used in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

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

Internet Technology

Wechat

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

12
Report