91 lines
2.7 KiB
C#
91 lines
2.7 KiB
C#
/******************************************************************************
|
|
Copyright 2005-2007 R2@DevFx.NET
|
|
DevFx.NET is free software; you can redistribute it and/or modify
|
|
it under the terms of the Lesser GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
DevFx.NET is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Lesser GNU General Public License for more details.
|
|
|
|
You should have received a copy of the Lesser GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
/*******************************************************************************/
|
|
|
|
using Lskj.DevFx.Config;
|
|
|
|
namespace Lskj.DevFx.Cache
|
|
{
|
|
/// <summary>
|
|
/// 缓存管理器接口
|
|
/// </summary>
|
|
/// <remarks>
|
|
/// 缓存管理器的配置:
|
|
/// <code>
|
|
/// <configuration>
|
|
/// ......
|
|
///
|
|
/// <cache type="缓存管理器类型">
|
|
/// <caches><!--这里配置缓存空间(多实例模式)-->
|
|
/// ......
|
|
/// </caches>
|
|
/// </cache>
|
|
///
|
|
/// ......
|
|
/// </configuration>
|
|
/// </code>
|
|
/// </remarks>
|
|
public interface ICacheManager
|
|
{
|
|
/// <summary>
|
|
/// 初始化,由框架调用
|
|
/// </summary>
|
|
/// <param name="setting">缓存管理器的配置节</param>
|
|
void Init(IConfigSetting setting);
|
|
|
|
/// <summary>
|
|
/// 获取缓存空间
|
|
/// </summary>
|
|
/// <param name="cacheName">在配置文件上配置的缓存空间名</param>
|
|
/// <returns>实现ICache接口的缓存器实例</returns>
|
|
ICache GetCache(string cacheName);
|
|
|
|
/// <summary>
|
|
/// 以一定的配置节来实例化缓存器
|
|
/// </summary>
|
|
/// <param name="cacheSetting">缓存器配置节</param>
|
|
/// <returns>实现ICache接口的缓存器实例</returns>
|
|
ICache GetCache(IConfigSetting cacheSetting);
|
|
|
|
/// <summary>
|
|
/// 新增一个缓存空间
|
|
/// </summary>
|
|
/// <param name="cacheName"></param>
|
|
/// <returns></returns>
|
|
ICache AddCache(string cacheName);
|
|
|
|
/// <summary>
|
|
/// 新增一个缓存空间
|
|
/// </summary>
|
|
/// <param name="cacheName"></param>
|
|
/// <param name="interval">清除过期缓存的间隔,单位:毫秒</param>
|
|
/// <returns></returns>
|
|
ICache AddCache(string cacheName, int interval);
|
|
|
|
/// <summary>
|
|
/// 移除指定名称的缓存空间
|
|
/// </summary>
|
|
/// <param name="cacheName"></param>
|
|
void RemoveCache(string cacheName);
|
|
|
|
|
|
/// <summary>
|
|
/// 移除所有缓存空间
|
|
/// </summary>
|
|
void Clear();
|
|
}
|
|
}
|