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