Before you begin this article, be sure to install the Redis extensions for Redis and Node.js and Node.js--node_redis
First create a new folder and new text file app.js the contents of the file are as follows:
var Redis = require ("Redis")
Objective
Redis is currently recognized as the fastest memory based on the key value of the database, but Redis's shortcomings are also very obvious, only provide the most basic hash set, list, sorted set, etc. based on data types, no table, no
Introduced
Redis is a key-value storage system. Like memcached, it supports a relatively larger number of stored value types, including string (string), list (linked list), set (set), Zset (sorted set– ordered set), and hash (hash type). These data
I. Installation of Redis
Redis installation is actually quite simple, the recommended way is to download the Redis source code, and after the installation of the machine compiled.
First access to the home folder download directory, the
Redis is a high-performance key-value storage system released under the BSD Open source protocol. Data is read into memory to improve access efficiency. Redis performance is extremely high-energy support for more than 100k+ per second read and write
Nodejs Redis Publish subscription mechanism encapsulation
Recent projects have used Redis to understand and encapsulate the use of publish and subscribe.
var config = require ('.. /config/config ');
var log = require ("./loghelp");
var
Summary one:
Memcache official definition
Free & Open Source, High-performance, distributed memory object caching system, generic into nature, but intended for us E in speeding up dynamic Web applications by alleviating database load.
Redis
Use of SDSThe main functions of Sds in Redis are as follows: two.
Implements a String object (Stringobject);Used as a char* type of substitute within the Redis program;The following two subsections describe each of these two uses.
Implementing a
If you think that Redis is a key value store, you can use it instead of MySQL, and if you think it is a persistent cache, you might just use it to save some of the frequently accessed temporary data (instead of memcached); Redis can also be used as
First, key pattern query the corresponding key
(1) Redis allows the fuzzy query key to have 3 wildcard characters * 、?、 []
(2) Randomkey: Return random key
(3) Type key: Returns the type of the key store
(4) Exists key: To determine whether a
1. Prepare to run the environment
* Set Oom Handler,zmalloc allocated memory failed to call* Initialize random seeds to generate random numbers* Initialize server parameters to default values* Create a mapping table for commands and processing
Requirements: function A needs to call a third-party API to get the data, and the third party API itself is asynchronous processing, after the call will return the data and state {information: "Query Results", "status": "In the Asynchronous
Install Redis service under CentOS
The Redis service installation steps are as follows:
wget http://download.redis.io/releases/redis-3.2.3.tar.gz
tar xzf redis-3.2.3.tar.gz
CD redis-3.2.3
Make make
Install
Basic configuration of Redis
First, Redis Introduction
Redis is one of the most popular NoSQL systems, and it is a key-value storage system. Similar to memcache, but largely compensates for the lack of memcache, which supports a relatively large number of stored value types,
Objective
Some students in some cases say why you can't use string type, string type can be completely implemented AH
I suggest you take a look at my column, "Redis Advanced Usage," which describes the benefits of using the hash type
Commodity
Session information into Redis
Session Introduction
session, Chinese often translated as a conversation, its original meaning is the beginning and end of a series of actions/messages , such as phone calls from the pick up the phone to hang up the
This article is mainly for six months ago to develop the red envelope module to organize, the main design ideas and specific implementation of the program to introduce, such as design and implementation of the defects, or there are loopholes, please
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.