优化SSO登录

This commit is contained in:
yubaolee
2016-12-27 11:25:51 +08:00
parent a3bdcf83ec
commit ccf1269eca
19 changed files with 108 additions and 240 deletions

View File

@@ -10,40 +10,29 @@
// ***********************************************************************
using System;
using Enyim.Caching;
using Enyim.Caching.Memcached;
namespace Helper.Cache
namespace Infrastructure.Cache
{
public sealed class EnyimMemcachedContext : ICacheContext
{
private readonly MemcachedClient _memcachedClient = new MemcachedClient("memcached");
public override void Init()
{
}
private static readonly MemcachedClient _memcachedClient = new MemcachedClient();
public override T Get<T>(string key)
{
return _memcachedClient.Get<T>(key);
}
public override bool Set<T>(string key, T t)
public override bool Set<T>(string key, T t, DateTime expire)
{
return _memcachedClient.Store(StoreMode.Set, key, t);
return _memcachedClient.Store(StoreMode.Set, key, t, expire);
}
public override bool Remove(string key)
{
return _memcachedClient.Remove(key);
}
public override void Dispose()
{
if (_memcachedClient != null)
{
_memcachedClient.Dispose();
}
}
}
}