C # connecting the In-memory database Redis "1, redis storage read Data"

Source: Internet
Author: User
Tags redis server

This section shows a download. NET how to use Redis to store data. The more common client class libraries in. NET are ServiceStack, and look at how the data is stored through ServiceStack.

DLL Download: Https://github.com/ServiceStack/ServiceStack.Redis

After the download is complete, the DLL includes four DLL files and then adds the four files to your project.

Redis includes four data types, Strings, Lists, sets, Sorted sets

Now let's look at these four types of usage

1. Connect to a Redis server

        redisclient client;         Private void button1_click (object  sender, EventArgs e)        {            // Connection Server             New redisclient ("127.0.0.1",6379);        }

2.Strings type
Strings can store strings, numbers and the like, floating-point types, and so on. The basic types in net

   Private voidButton2_Click (Objectsender, EventArgs e) {            //Store user name and passwordClient. set<string> ("username","[email protected]"); Client. Set<int> ("pwd",123456); stringUsername = client. get<string> ("username"); intPwd=client. get<int> ("pwd"); Client. Set<decimal> (" Price",12.10M); decimalPrice = client. get<decimal> (" Price"); MessageBox.Show (price.            ToString ()); MessageBox.Show ("User name:"+username+", Password:"+pwd.        ToString ()); }

C # connecting the In-memory database Redis "1, redis storage read Data"

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.