About the use of memcached and Redis scene, according to the great God's discussion and I found the information on the Internet, summed up: The comparison: The Redis provides data persistence function, memcached no persistence; Redis's data
2015-07-23/jockchou
Due to the needs of the product requirements, we do in the product to achieve similar micro-blog in the concern. In the past blog, "Using MySQL to realize the focus of the relationship between the program analysis" of the MySQL
Look at the main parts of App.js first.
Io.sockets.on (' Connection ', function (socket) {var Credis = redis.createclient ();
Credis.auth (' Chenqiguo ');
Subscribe to a channel Redis link var subscribe = redis.createclient ();
One: Introduction to the principle
Take a look at what the current system has set up from the boot program:
[Root@localhost init.d]# chkconfig--listNote:this output shows SYSV services only and does not include nativeSYSTEMD Services. SYSV
First, overview:
The hash type in Redis is considered to be a map container with Stringkey and string value. So the type is ideal for storing information about a value object. such as username, password and age. If the hash contains few fields, the
First, overview:
In Redis, we can look at a set type as an unordered character set, and like the list type, we can also perform actions such as adding, deleting, or determining whether an element exists on that type of data value. It should be
Business requirements
The app client sends the JSON data to the server interface once a day, emptying the cache and sending it again.
Business logic before a problem:
The PHP interface first converts JSON to an array to insert nonexistent data in
Phenomenon: In the pagoda is clearly installed Redis, can run Redis related programs or prompts:
ERR: System not supported: Redis
Reason: View PHP extension library inside there is no redis.so, but Redis.so is Redis compiled out of it, finally
The function of the Setbit function is to set or clear bits (bit) on the specified offset for the string value stored by the key.
In Redis, stored strings are stored in the form of a two-level system. For example, the string "AA" binary form 01000001
Redis Publish Subscription (PUB/SUB) is a way of messaging: the publisher (pub) sends a message, and the Subscriber (sub) receives the message.
Redis clients can subscribe to any number of channels.
Introduction to related functions:
From the following several dimensions, the Redis, Memcache, MongoDB made a comparison, welcome to shoot Bricks
1. Performance is relatively high, performance for us should not be the bottleneck overall, the TPS () aspect of Redis and Memcache is
The Salvatore Sanfilippo, the author of Redis, once compared these two memory-based data storage systems, and is generally more objective, and is summarized as follows:
Performance comparison: Since Redis uses only single cores, and memcached can
An issue occurred when inserting data using Jedis:Redis.clients.jedis.exceptions.JedisDataException:WRONGTYPE operation against a key holding the wrong kind of value
The code is probably implemented like this:
hashmap map = new hashmap ();
It is stored in the cache for Redis, so the problem of cache data loss has always been a topic of considerable concern to programmers, so the need to persist the data in the cache is quite prominent, and the following are the related configurations
Currently Redis supports two persistence modes, one is snapshotting (snapshot) and the other is Append-only file (AOF).Snapshotting (snapshot): The default persistence mode, which is to write in-memory data to a binary file in a snapshot (the
Installation
System: centos6.4
redis Download: http://www.redis.cn/download.html
Redis installation steps:
upload source package to/lamp
decompression: TAR-ZXVF redis.tar.gz
CD Redis
make/compile source, first installed Linux system This step may be
Java Connection RedisOne, import jar packageWhat are the commands for Redis, Jedis? How to set up a firewallRun the following code on Linux:Single instance: Jedis instance: PackageCom.jedis.demo;Importorg.junit.Test;ImportRedis.clients.jedis.Jedis;
To read this article, please read the installation redis1. Redis DependencyYum Install gcc-c++2. UnzipThe directory where the CD Redis compression package residesTAR-XVF redis-4.0.10.tar.gz3. CompilingCD Redis unpacking inside and
1: Downloadwget HTTP://DOWNLOAD.REDIS.IO/RELEASES/REDIS-3.2.8.TAR.GZ1Download the specified version, you can log in Https://redis.io/download view2: InstallationTar zxvf redis-3.2.8.tar.gzcd Redis-3.2.8makesudo make install1234The Redis executable
1, First officer network Download Redis compressed package, address: Http://redis.io/download Download stable version 4.0.10 can2. Through the remote management tool, copy the compressed package to the Linux server and perform the decompression
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service