mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-19 18:22:11 +08:00
add missing files
This commit is contained in:
49
Infrastructure/Cache/EnyimMemcachedContext.cs
Normal file
49
Infrastructure/Cache/EnyimMemcachedContext.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user