假设还没有配置Azure Power shell 能够參照这里进行配置:
http://blog.csdn.net/lan_liang/article/details/46850221

打开Azure Power Shell

1. 执行

Add-AzureAccount

(假设已经加入就不用了)

2. 执行 

New-AzureManagedCache -Name mycache -Location "South Central US" -Sku Basic -Memory 128MB

进到Azure Cache页面,能够看到Cache正在创建

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="" />


3. 进入https://portal.azure.com/#create/Microsoft.Cache.1.0.4创建Cache

4. 点击菜单Redis Caches 能够看到redis已经创建好了:

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" style="font-size:14px;" alt="" />

5. 安装nuget package

6. Console Application的代码:

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", 25); // 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在这里看:

将代码中的"your_domain"替换为你的DNS。password替换为你的PrimaryKey

最新文章

  1. [转]从JVM角度看线程安全与垃圾收集
  2. 在Tomat7上使用Redis保存Session
  3. Model层数据验证
  4. mysql获取插入时自增ID值的方法
  5. js object(对象)
  6. jsp获取struts2查询到的数据
  7. Cannot connect to (local) sql server 2008
  8. iOS中UIWebView使用JS交互 - 机智的新手
  9. 老男孩Python全栈开发(92天全)视频教程 自学笔记03
  10. 使用JAXB解析xml文件(一)
  11. Numpy数组数据文件的读写
  12. css 积累
  13. Python assert(断言)
  14. T4 反射实体模型生成代码(Demo)
  15. 51nod1305
  16. 爬虫学习06用selenium爬取空间
  17. ubuntu16 配置git
  18. 5E - A + B Again
  19. Java虚拟机 - 结构原理与运行时数据区域
  20. java编码-多重(乱码)

热门文章

  1. git如何打补丁?
  2. httpd 服务的两个节点的HA
  3. crontab 写入文件目录
  4. 如何看待Linux操作系统的用户空间和内核空间
  5. http://zhidao.baidu.com/link?url=3tJ_i5gyYLrd7rFPk0eRYre_oxjCZvTOMOutp89LGhUgi6Ic6Ncama_GMAHnwfF73SVYGqy364vDfv6AY4ERPa
  6. XAMPP Apache + MySQL + PHP + Perl
  7. MyTools
  8. C#异常处理机制初步
  9. c和c++在windows下获取时间和计算时间差的方法总结
  10. CASE WHEN 的用法