Windows Server AppFabric缓存参考实例和方案选择 2/3

实例

Web Camps Training Kit[MSDN上可以下载,如下的地址]

http://download.microsoft.com/download/4/D/A/4DA69FF9-A83D-4139-8F0E-7E01D8684F6D/WebCampsTrainingKit.Setup.20100720.exe

中\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,一个成熟而且应用比较广泛的开源软件。

下文有个分析

http://www.cnblogs.com/dudu/archive/2010/08/05/1792948.html

原文地址:https://www.cnblogs.com/2018/p/1835340.html