add missing files

This commit is contained in:
yubaolee
2016-07-08 22:52:40 +08:00
parent 3a628c05e0
commit f127a7238c
6 changed files with 417 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
// ***********************************************************************
// Assembly : Infrastructure
// Author : yubaolee
// Created : 06-21-2016
//
// Last Modified By : yubaolee
// Last Modified On : 06-21-2016
// Contact :
// File: EnyimMemcachedContext.cs
// ***********************************************************************
using Enyim.Caching;
using Enyim.Caching.Memcached;
namespace Infrastructure.Cache
{
public sealed class EnyimMemcachedContext : CacheContext
{
private readonly MemcachedClient _memcachedClient = new MemcachedClient("memcached");
public override void Init()
{
}
public override T Get<T>(string key)
{
return _memcachedClient.Get<T>(key);
}
public override bool Set<T>(string key, T t)
{
return _memcachedClient.Store(StoreMode.Set, key, t);
}
public override bool Remove(string key)
{
return _memcachedClient.Remove(key);
}
public override void Dispose()
{
if (_memcachedClient != null)
{
_memcachedClient.Dispose();
}
}
}
}