OpenAuth.Net/Infrastructure/Cache/EnyimMemcachedContext.cs
yubaolee 9fd0405721 同步openauth.Core:
采用代码生成器的表结构控制前端显示,删除以前按照dbset获取数据库结构
优化注释
升级EF及所有三方的版本
2021-10-18 00:42:29 +08:00

51 lines
1.4 KiB
C#

// ***********************************************************************
// Assembly : Infrastructure
// Author : yubaolee
// Created : 06-21-2016
//
// Last Modified By : yubaolee
// Last Modified On : 06-21-2016
// Contact : Add services.AddEnyimMemcached(...)
// and app.UseEnyimMemcached() in Startup.
// File: EnyimMemcachedContext.cs
// ***********************************************************************
using System;
using Enyim.Caching;
using Enyim.Caching.Memcached;
namespace Infrastructure.Cache
{
public sealed class EnyimMemcachedContext : ICacheContext
{
private IMemcachedClient _memcachedClient;
public EnyimMemcachedContext(IMemcachedClient client)
{
_memcachedClient = client;
}
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
public override T Get<T>(string key)
{
return _memcachedClient.Get<T>(key);
}
public override bool Set<T>(string key, T t, DateTime expire)
{
return _memcachedClient.Store(StoreMode.Set, key, t, expire);
}
public override bool Remove(string key)
{
return _memcachedClient.Remove(key);
}
}
}