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 ();
1. Separation of hot and cold data, do not put all the data in the Redis
Although Redis supports persistence, the data storage for Redis is all in memory and costly. It is recommended to store only high-frequency thermal data in Redis "QPS greater
key pattern Query the corresponding key
(1) Redis allow fuzzy query key has 3 wildcard characters * 、?、 []
(2) Randomkey: Return to Random key
(3) Type key: Returns the type of the key store
(4) Exists key: Determine if a key exists
(5) Del key:
There are two issues to consider when using Redis as a MySQL database cache:1. Determine what data structure is used to store the information from MySQL;2. After determining the data structure, what identity is used as the key of the data structure .
Turn from 769064221. PrefaceRedis has recently been used in projects to cache, allowing data to be shared between multiple business processes. Since Redis data is stored in memory, if no persistence is configured, the data is lost after the Redis
NoSQL: A new class of emerging databases (not only SQL)
A non-relational database
SQL syntax not supported
The storage structure is completely different from the relational table in the traditional relational database, and the data
Introduction to using Redis as a cache for MySQL
In the actual project, the MySQL database server is sometimes located in another host, need to access the database through the network, even if the application and the MySQL database in the
1. Data snapshot Rdb1.1 Principle(1) An RDB is a way to persist data from a moment to disk, which is a snapshot.(2) Redis in the process of data persistence, the data will be written to a temporary file, until the persistence process is over, the
The database is divided into two categories:1. Relational database: Mysql,oracle,sql server,db2,sqliteSQL statement Requireddata exists on disk2. Non-relational database: MongoDB, RedisNo table structureNo SQL statementuse Get (' K '), set (' xx
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. Redis and memcache all store data in memory, which is the memory database. But Memcache can also be used to cache other things, such as films, videos and so on; 2,Redis not only support simple k/v type of data, but also provide list,set,hash and
You need to remove the value from the original Redis key stored in the project startup, so use Scan_iter to facilitate the relevant key and delete it.There are two performance issues to be aware of1. Scan_iter's fuzzy matching filter should be
Redis installation skippedFirst import the Jedis.jar package1. Connect to Redis ServiceWrite a simple program: package Com.fpc.Test; import Redis.clients.jedis.Jedis; public class Manipulateredis { public static void main (string[] args)
1. Add @EnableCaching annotations on the startup class (no jar package required, as already available)2. Add @cacheable (cachenames = "blog", key= "123") on the method that requires caching3. When you want to change, add the annotation @cacheput in
One, single-threading modelEach invocation of the Redis client to the server undergoes the sending of a command, which executes the command and returns the result in three processes. Where the command stage is executed, since Redis is
One, Redis API supportRedis provides APIs for a variety of development languages to facilitate the development of language connections using Redis. HTTPS://redis.io/clients The official website provides API programs for different development
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.