Small test of using AppFabric or Redis to store serialized objects
After this you can run
DistributedCacheCLI.exeThis will:
- insert 1,000 objects,
- read them again,
- After two minutes the objects will have expired.
To install this simple DistributedCache client, run the following command in the Package Manager Console
Install-Package DistributedCache.Shared
Install-Package DistributedCache.AppFabricusing DistributedCache;
var cacheHelper = new AppFabricCache<string>();
cacheHelper.Set("key", "value", new TimeSpan(0, 0, 2, 0));
var cachedstring = cacheHelper.Get("key");<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="APPFABRIC_SERVER_HOSTNAME" value="localhost"/>
<add key="APPFABRIC_SERVER_PORT" value="22233"/>
<add key="APPFABRIC_CACHENAME" value="[cachename]"/>
</appSettings>
</configuration>| @gbraad |