实例
Web Camps Training Kit[MSDN上可以下载,如下的地址]
中\Labs\EnhancingYourWebApp\Source\Ex01-AddingAppFabricCache有这个的详细说明
Start-CacheCluster
New-Cache –CacheName **
$usr = [Environment]::UserName
Grant-CacheAllowedClientAccount -account $usr
Get-Cache
Get-CacheStatistics –CacheName ***
Restart-CacheCluster
<configSections>
<!-- required to read the <dataCacheClient> element -->
<section name="dataCacheClient" type="Microsoft.ApplicationServer.Caching.DataCacheClientSection, Microsoft.ApplicationServer.Caching.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" allowLocation="true" allowDefinition="Everywhere"/>
</configSections>
<dataCacheClient>
<hosts>
<host name="127.0.0.1" cachePort="22233" />
</hosts>
</dataCacheClient>
<!--AppFabric session state provider-->
<sessionState mode="Custom" customProvider="AppFabric">
<providers>
<add name="AppFabric" type="Microsoft.ApplicationServer.Caching.DataCacheSessionStoreProvider, Microsoft.ApplicationServer.Caching.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</providers>
</sessionState>
这个实例有个测试程序实现各种操作的演示.
缓存方案选择
AppFabric 缓存虽然功能强大,但是和Windows系统绑定,而且不是开源,对于一些对于服务器成本有限制或则Linux的环境,一般都使用Memcached,一个成熟而且应用比较广泛的开源软件。
下文有个分析