The use of Redis in C # and the encapsulation of Redis

Source: Internet
Author: User
Tags benchmark configuration settings redis server value store

Redis is an open-source, high-performance key-value store (Key-value store). It is often referred to as a data structure server (data structure server). The key values for Redis can include data types such as strings (strings), hashes (hashes), lists (lists), collections (sets), and ordered collections (sorted sets). For these data types, you can perform atomic operations. For example: attaching an operation to a string (append), incrementing a value in a hash, adding an element to a list, calculating the intersection of a set, a set and a difference set, and so on.

to achieve superior performance, Redis uses an in-memory (in-memory) DataSet (DataSet) approach. Depending on the scenario, you can dump the dataset to disk at intervals, persist the data, or append each action command at the end of the log.

Redis also supports master-slave replication (Master-slave replication) and features very fast non-blocking first-time synchronization (Non-blocking-synchronization), network disconnection, and so on. Redis also has other features, including a simple check-and-set mechanism, pub/sub, and configuration settings, so that Redis can behave more like a cache.

Redis also provides a rich client to support most of the programming languages that are prevalent at this stage. A detailed support list can be see the Redis official documentation: Http://redis.io/clients. Redis itself is written using ANSI C and can run on most POSIX systems without generating external dependencies (external dependencies), such as Linux, *bsd, OS X, and Solaris.

Redis consists of four executables: Redis-benchmark, Redis-cli, Redis-server, redis-stat four files, plus a redis.conf that forms the final available package for the entire redis. Their role is as follows:

Redis-server:redis Server Daemon startup program
Redis-cli:redis Command-line operation tool. Of course, you can also use Telnet to operate on its plain text protocol.
Redis-benchmark:redis Performance testing tools to test the read and write performance of Redis in your system and in your configuration
Redis-stat:redis Status Detection Tool to detect Redis current status parameters and delay status

Redis can now be started, and Redis has only one boot parameter, which is his profile path.

First, you have to open redis-server, otherwise you cannot connect the service:

650) this.width=650; "title=" image "border=" 0 "alt=" image "src=" http://images2015.cnblogs.com/blog/117155/201702/ 117155-20170226123411163-642508975.png "style=" border:0px; "/>

Open Redis-server:

650) this.width=650; "title=" image "border=" 0 "alt=" image "src=" http://images2015.cnblogs.com/blog/117155/201702/ 117155-20170226123412116-1851026028.png "style=" border:0px; "/>

You can then invoke the properties of Redis to store and retrieve the data:

650) this.width=650; "title=" image "border=" 0 "alt=" image "src=" http://images2015.cnblogs.com/blog/117155/201702/ 117155-20170226123413148-1641126893.png "style=" border:0px; "/>


The use of Redis in C # and the encapsulation of Redis

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.