Windows Azure Series--Configuration and use of azure Redis cache

Source: Internet
Author: User

If you have not yet configured Azure Power shell, you can configure it here:
http://blog.csdn.net/lan_liang/article/details/46850221

Open the Azure Power Shell


1. Running
Add-azureaccount

(Not if you have added it)


2. Running
New-azuremanagedcache-name mycache-location "South Central US"-sku basic-memory 128MB


In the Azure cache page, you can see that the cache is creating



3. Enter https://portal.azure.com/#create/microsoft.cache.1.0.4 Create Cache





4. Click on the menu Redis Caches to see that Redis has been created:





5. Install the NuGet package




6. Console Application code:

static void Main (string[] args)        {            Connectionmultiplexer connection = Connectionmultiplexer.connect ("Your_ Domain.redis.cache.windows.net,ssl=true,password=yourprimarykey ");            Idatabase cache = connection. Getdatabase ();            Perform cache operations using the Cache object            ... Simple put of integral data types into the cache            cache. Stringset ("Key1", "value");            Cache. Stringset ("Key2");            Simple get of data types from the cache            string key1 = cache. Stringget ("Key1");            Console.WriteLine (key1);            int key2 = (int) cache. Stringget ("Key2");            Console.WriteLine (Key2);            Console.read ();        }






PrimaryKey here to see:



Replace "Your_domain" in your code with your dns,password and replace it with your PrimaryKey

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Windows Azure Series--Configuration and use of azure Redis cache

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.