Skip to content

Instantly share code, notes, and snippets.

@pkellner
Created September 14, 2016 13:36
Show Gist options
  • Save pkellner/f58abe4894e2ae1fb0cddf211b733838 to your computer and use it in GitHub Desktop.
Save pkellner/f58abe4894e2ae1fb0cddf211b733838 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using ClassLib.CacheExtension;
namespace WebApp
{
public class TCache<T>
{
public T Get(string cacheKeyName, int cacheTimeOutSeconds,
Func<T> func)
{
var redisCache =
ConfigurationManager.AppSettings["RedisCache"];
if (redisCache == "true")
{
return new TCacheRedis<T>().
Get(cacheKeyName, cacheTimeOutSeconds, func);
}
else
{
return new TCacheInternal<T>().Get(
cacheKeyName, cacheTimeOutSeconds, func);
}
}
//public T Get(string cacheKeyName, int cacheTimeOutSeconds,
// Func<T> func)
//{
// return new TCacheInternal<T>().Get(
// cacheKeyName, cacheTimeOutSeconds, func);
//}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment