Beginner Redis Cache Technology, if the article is not well written, please understand
Application Environment: Win7
Implementation environment: Cmd,eclipse
The Redis cache technology is characterized by its high efficiency, as the amount of data involved is increasing, especially when it comes to storage of data and optimization of SQL and server resources.
While Redis can help solve the latency caused by database stress, we can consistently add memory for data that is rarely changed and used frequently. This can reduce the database pressure on the one hand, improve read and write efficiency.
1. The first step is to download the corresponding compression package on the Redis official website. : https://github.com/MSOpenTech/redis/releases
2, unzip to the corresponding directory (my directory is: E:\Development Tools\redis)
3. Start the Redis service (via cmd mount), Linux can manually perform the mount
This is the flag for successful startup under Windows
4, here can reopen a CMD to display the client
This will enter the specific customer service operation.
Related commands and implementations can be consulted: http://www.runoob.com/redis/redis-commands.html
5, in order to better test the specific practical application, we use Java as an example
1) Download the Redis jar package as the operating interface to drive Redis. : Http://mvnrepository.com/artifact/redis.clients/jedis
2) for a simple test, I wrote a simple test project, the level is limited, Daniel skipped
This is the Redis drive jar package I used, Jedis.jar
3) Java test Code (mainly the principle, concrete implementation can be achieved in specific projects)
Import Redis.clients.jedis.Jedis;
publicclass Testredis { publicstaticvoid main (string[] args) { new Jedis ("localhost"); System.out.println ("Connection succeeded");
Redis.set ("Redistest", "redistest");
System.out.println (Redis.get ("redistest"));
}}
Results show:
6, the effect is simple point, but the basic principle is this way, how to actually use:
1) We use the database connection to obtain the corresponding data
2) storing data in the corresponding data format such as: Hash, List, set, string, etc.
3) The data will be cached on the appropriate server
4) How to relate to cross-server, where the specific implementation to obtain data, you can use the above example to achieve the specific data acquisition
5) Redis Save data in addition to memory can be persisted, stored in the Redis directory under the Rdb file
6) Data backup can be achieved
7, the general Redis is such a son, the specific development and application to achieve in the specific process, including some deployment and data connection settings, as well as some of the connection pool settings
8, the inside is very important is the Redis pipeline technology, this point in the efficiency of the implementation is very important
Redis Cache Technology