// ***********************************************************************
// Assembly : Helper
// Author : Administrator
// Created : 12-21-2016
//
// Last Modified By : Administrator
// Last Modified On : 12-22-2016
// Contact :
// File: ObjCacheProvider.cs
// ***********************************************************************
using System;
namespace Infrastructure.Cache
{
///
/// 缓存工厂实现
/// 这样做是方便换其他的缓存时(如memcachedContext)只换这一个地方即可
///
public class ObjCacheProvider : CacheProvider
{
public ObjCacheProvider()
{
SetCacheInstance(new CacheContext());
}
public bool Create(string key, T val, DateTime expire)
{
//设置缓存
return CacheContext.Set(key, val, expire);
}
///
/// 根据失效时间获取缓存
/// 李玉宝于2016-11-08 16:54:04
///
/// The key.
public T GetCache(string key)
{
return CacheContext.Get(key);
}
public void Remove(string key)
{
CacheContext.Remove(key);
}
}
}