http://msdn.microsoft.com/en-us/library/ee790941(v=azure.10).aspx

Preparing the Visual Studio Project
http://msdn.microsoft.com/en-us/library/ee790876(v=azure.10).aspx

To initialize and start your cache cluster:
Use-CacheCluster
New-Cache
Grant-CacheAllowedClientAccount
Start-CacheCluster

Open your Visual Studio .NET project.
In Solution Explorer, right-click the project name and then select Add Reference.
Select the Browse tab of the Add Reference dialog.
Navigate to the .\Windows\System32\AppFabric directory.
Add a reference to the following two assemblies: Microsoft.ApplicationServer.Caching.Client.dll and Microsoft.ApplicationServer.Caching.Core.dll.
Optionally, add the using statement (Imports in Visual Basic) at the top of the code files to reference the Microsoft.ApplicationServer.Caching namespace.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks; using Microsoft.ApplicationServer.Caching; namespace AppFabricCaching
{
class Program
{
[Serializable]
class User
{
public string name;
public string gender;
public int age; public override string ToString()
{
return "name:" + name + System.Environment.NewLine +
"gender:" + gender + System.Environment.NewLine +
"age:" + age.ToString();
}
}
static void Main(string[] args)
{ //To configure a cache client programmatically
DataCacheServerEndpoint[] servers = new DataCacheServerEndpoint[];
servers[] = new DataCacheServerEndpoint("sv1", );
DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();
factoryConfig.Servers = servers;
// Create a configured DataCacheFactory object.
DataCacheFactory mycacheFactory = new DataCacheFactory(factoryConfig);
// Get a cache client for the cache "NamedCache1".
DataCache myDefaultCache = mycacheFactory.GetCache("NamedCache1"); var cache = myDefaultCache;
cache.Add("zy", new User() { name="zy", gender="m", age= });
var user = (User)cache.Get("zy");
Console.WriteLine(user.ToString()); Console.ReadLine(); }
}
}

appfabric 简单应用的更多相关文章

  1. Windows Server AppFabric 安装文档

    安装指南 入门标题页 3 Windows Server AppFabric 安装和配置指南 3 版权 3 版权所有 3 简介 3 清单:规划安装 4 硬件要求 4 使计算机作好安装准备 5 本节内容 ...

  2. 浅谈Windows Server APPFABRIC

    hi,everyone !真的是好久好久没有update blog了,因为最近忙着备考,没有时间对<数据结构与算法>进行研究学习了.所以,blog一直未更新.today is Friday ...

  3. Windows Server AppFabric分布式缓存研究

    分享一则先前对Windows Server AppFabric分布式缓存的技术研究. 一. AppFabric 技术架构和原理 AppFabric与Memcached类似,采用C/S的模式,在 ser ...

  4. 【造轮子】打造一个简单的万能Excel读写工具

    大家工作或者平时是不是经常遇到要读写一些简单格式的Excel? shit!~很蛋疼,因为之前吹牛,就搞了个这东西,还算是挺实用,和大家分享下. 厌烦了每次搞简单类型的Excel读写?不怕~来,喜欢流式 ...

  5. Fabio 安装和简单使用

    Fabio(Go 语言):https://github.com/eBay/fabio Fabio 是一个快速.现代.zero-conf 负载均衡 HTTP(S) 路由器,用于部署 Consul 管理的 ...

  6. node.js学习(三)简单的node程序&&模块简单使用&&commonJS规范&&深入理解模块原理

    一.一个简单的node程序 1.新建一个txt文件 2.修改后缀 修改之后会弹出这个,点击"是" 3.运行test.js 源文件 使用node.js运行之后的. 如果该路径下没有该 ...

  7. 哪种缓存效果高?开源一个简单的缓存组件j2cache

    背景 现在的web系统已经越来越多的应用缓存技术,而且缓存技术确实是能实足的增强系统性能的.我在项目中也开始接触一些缓存的需求. 开始简单的就用jvm(java托管内存)来做缓存,这样对于单个应用服务 ...

  8. 在Openfire上弄一个简单的推送系统

    推送系统 说是推送系统有点大,其实就是一个消息广播功能吧.作用其实也就是由服务端接收到消息然后推送到订阅的客户端. 思路 对于推送最关键的是服务端向客户端发送数据,客户端向服务端订阅自己想要的消息.这 ...

  9. 我的MYSQL学习心得(一) 简单语法

    我的MYSQL学习心得(一) 简单语法 我的MYSQL学习心得(二) 数据类型宽度 我的MYSQL学习心得(三) 查看字段长度 我的MYSQL学习心得(四) 数据类型 我的MYSQL学习心得(五) 运 ...

随机推荐

  1. word-wrap,word-break,text-wrap的区别

    今晚看到了无双老师关于word-wrap,word-break区别的讲解  http://www.cnblogs.com/2050/archive/2012/08/10/2632256.html 受益 ...

  2. php验证码制作

    目标: 使用php生成验证码 成品: 逻辑代码: authcode.php <?php header("Content-type:image/png"); session_s ...

  3. java基础学习总结二(标识符、字符集、数据类型以及类型转换)

    一:标识符 1:标识符可以由字母.数字.下划线_.$符等组成2:标识符的首字母只能是字母.数字.下划线3:标识符不能使用关键字或者保留字4:标识符可以是中文,但是不建议使用中文5:标识符可以任意长,没 ...

  4. hdu 1040 As Easy As A+B

    As Easy As A+B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) T ...

  5. CSS属性[text-overflow]使用问题

    text-overflow:clip | ellipsis 这个属性使用必须通过几个属性一块才能使用 1,overflow:hidden; 这个属性是内容区装不下内容应该怎么办.这里让溢出内容直接不显 ...

  6. 第六章 jQuery操作表单

    1.单行文本框的应用 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// ...

  7. SQL-学习使用FOR XML PATH

    前言:本人SQL技术很烂,然后工作时间也不久,许多东西都还在学习中,说的不好的地方尽请谅解. 首先跟大家说一下我今天遇到的问题吧. 查出的数据有三列,第一列存放的是32位的GUID,Res_Name存 ...

  8. 基于node/mongo的App Docker化测试环境搭建

    搭建步骤: 1.宿主机环境  ubuntu 14.4宿主机环境(云主机): 安装wget与curl(sudo apt-get install wget curl)2.安装Docker (wget -q ...

  9. TCP/IP协议三次握手与四次握手流程解析(转载及总结)

    原文地址:http://www.2cto.com/net/201310/251896.html,转载请注明出处: TCP/IP协议三次握手与四次握手流程解析 一.TCP报文格式  TCP/IP协议的详 ...

  10. Colored Linux Man pages

    Colored Linux Man pages 一.什么是Linux Man 参考: 二.如何高效率地使用Man 三.给Linux Man命令添加点颜色. 1.Unix / Linux: Displa ...