Redis caches data in Windows for timed update reads

Source: Internet
Author: User
Tags delete key

The realization of the interface reading in memory, the realization of the Web site directly read the memory data, greatly reducing the waiting time brought by the access interface, this function is more practical

Need to download ' class library ' and ' redis-x64-3.2.100 package '

Baidu Cloud Material: Link: Link: https://pan.baidu.com/s/1boYltxl

The password is open on the http://www.cnblogs.com/AnkerZhang/and you can see it.

1. After downloading the material, install the "redis-x64-3.2.100 package" on the WINDOWS64 bit system

To teach you how to use Redis, I uninstalled the Redis on my computer and reinstalled it again.

  

The installation steps are the next step, agree, you know,

Here I put the installation path under the D-Disk Redis folder, the folder is created by itself, installation location you're free to be happy.

  

The port number chosen here may be different, and the Scarlet Letter means "The Firewall service must be running to add a new exception" and then after the installation is complete

  

2. Run the cmd console

  

First Open D:

  CD Redis

Redis-cli.exe

The installation path may not be the same as always you run just install the redis-cli.exe just fine

3. Next, test the Redis storage capabilities of this computer.

The storage format is in the form of a key-value pair "Key,vaule" programmers understand

Method 1 Get key: Get the value of key

Method 2 Set Key value setting key is the Value,key value if there is a replacement, well understood.

Method 3:del Key Delete key

Instance:

4. This is the value stored in computer memory how to get and set in the program

Download to see the universe Invincible vs I created a console program Redisdemo

The 8 DLL libraries downloaded in Baidu Cloud are referenced in

  

namespaceredisdemo{classProgram {Static voidMain (string[] args) {            //First new Redis client class, parameter is (IP, port number)Redisclient Redis =NewRedisclient ("127.0.0.1",6379); Redis.set<string> ("Name","anker_zhang[Blog Park]"); stringName= redis.get<string> ("Name"); Console.WriteLine ("The name value is: {0}", name); Redis.del ("Name"); Console.WriteLine ("removed the Name Key"); Name= redis.get<string> ("Name"); Console.WriteLine ("The name value is: {0}", name); Console.WriteLine ("******* Of course here are read memory values, cmd console settings in the key program can also be obtained to *******"); stringContent = redis.get<string> ("Content"); Console.WriteLine ("content in the CMD console settings, Content value: {0}", content);        Console.ReadLine (); }    }}

This realizes the Redis through the program to read the data, the general function with the interface data use comparison, can greatly reduce the time spent on the request interface

About Redis

With Membercache and a variety of databases, why is Redis generated? Redis is purely for applications, and it is a high-performance Key-value database. The emergence of Redis, to a large extent, compensates for the memcached of such keyvalue storage, solves the situation that the data is completely lost after power outage, and in some cases can be a good complement to the relational database. The performance test results indicate that the set operation can be up to 110,000 times per second, and the get operation is 81,000 times/sec (of course different Server configuration performance differs).

Redis is a distributed NoSQL database system for "key/value" type data, characterized by high performance, persistent storage, and adapting to high concurrency scenarios. Similar to memcached, it supports storing more value types, including string (string), list (linked list), set (set), and Zset (ordered collection). These data types support Push/pop, Add/remove, and intersection sets and differences and richer operations, and these operations are atomic and support a variety of different ways of sorting. Redis is like memcached, where data is cached in memory to ensure efficiency. The difference is that Redis periodically writes the updated data to disk or writes the modified operation to the appended record file, and Master-slave (Master-Slave) synchronization is implemented on this basis.

Redis currently offers four types of data: String,list,set and Zset (sorted set).

The Redis storage is divided into memory storage, disk storage, and log files, which are configured with three parameters in the configuration file.

    1. Save seconds Updates: Indicates how many times the update operation has been synchronized to the data file.
    2. AppendOnly yes/no: Whether to log records after each update operation. If it is not turned on, it may result in loss of data over a period of time when power is lost. Because the Redis itself synchronizes data files in sync with the save conditions above, some data will only exist in memory for a period of time.
    3. Appendfsync no/always/everysec: How the data cache is synchronized to disk. No indicates that the data cache of the operating system is synchronized to disk, always indicates that the data is written to disk manually after each update operation, and EVERYSEC indicates that synchronization occurs every second.

Redis caches data in Windows for timed update reads

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.