Skip to content

A small example of distributed caching (C#/.NET) using Redis or AppFabric. Note: This is not production-ready code

Notifications You must be signed in to change notification settings

lanicon/DistributedCache

 
 

Repository files navigation

C# .NET Distributed Caching client

Small test of using AppFabric or Redis to store serialized objects

After this you can run

  DistributedCacheCLI.exe

This will:

  • insert 1,000 objects,
  • read them again,
  • After two minutes the objects will have expired.

Installation

To install this simple DistributedCache client, run the following command in the Package Manager Console

Install-Package DistributedCache.Shared
Install-Package DistributedCache.AppFabric

Usage

using 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>

Authors

"Gerard Braad"
@gbraad

About

A small example of distributed caching (C#/.NET) using Redis or AppFabric. Note: This is not production-ready code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%