33 lines
681 B
C#
33 lines
681 B
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using CacheManager.Core;
|
|||
|
|
|
|||
|
|
namespace Common
|
|||
|
|
{
|
|||
|
|
public class GlobalCache
|
|||
|
|
{
|
|||
|
|
private static ICacheManager<object> cacheManager { get; set; }
|
|||
|
|
|
|||
|
|
private static readonly object locker = new object();
|
|||
|
|
|
|||
|
|
static GlobalCache()
|
|||
|
|
{
|
|||
|
|
if (cacheManager == null)
|
|||
|
|
{
|
|||
|
|
lock (locker)
|
|||
|
|
{
|
|||
|
|
//cacheManager = CacheFactory.Build("memcached", settings => settings.WithMemcachedCacheHandle("enyim.com/memcached"));
|
|||
|
|
cacheManager = CacheFactory.FromConfiguration<object>("myCache");
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public static ICacheManager<object> CacheManager
|
|||
|
|
{
|
|||
|
|
get { return cacheManager; }
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|