/******************************************************************************
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
{
///
/// 缓存器的存储接口
///
///
/// 缓存器存储接口的配置:
///
/// <configuration>
/// ......
///
/// <cache type="Lskj.DevFx.Cache.CacheManager">
/// <caches>
/// ......
/// <cache name="缓存器名称" type="缓存器类型" interval="检查过期的时间间隔,0或小于0表示不进行检查">
/// <!--这里配置缓存存储器-->
/// <cacheStorage type="实现缓存存储器接口的类型" />
/// </cache>
/// ......
/// </caches>
/// </cache>
///
/// ......
/// </configuration>
///
///
public interface ICacheStorage
{
///
/// 初始化
///
/// 配置节
void Init(IConfigSetting setting);
///
/// 获取设置一个存储项
///
/// 存储项的健值
object this[string key] { get; set; }
///
/// 获取设置一个存储项
///
/// 存储项的索引值
object this[int index] { get; set; }
///
/// 获取此存储器所存储项的个数
///
int Count { get; }
///
/// 添加一项到存储器中
///
/// 存储项的健值
/// 存储的对象
///
/// 如果存在相同的健值,则更新存储的对象
///
void Add(string key, object @value);
///
/// 获取存储项
///
/// 存储项的健值
/// 存储的对象,如果存储中没有命中,则返回null
object Get(string key);
///
/// 获取存储项
///
/// 存储项的索引值
/// 存储的对象,如果存储中没有命中,则返回null
object Get(int index);
///
/// 设置存储项
///
/// 存储项的健值
/// 存储的对象
///
/// 仅针对存在存储项,若不存在,则不进行任何操作
///
void Set(string key, object @value);
///
/// 设置存储项
///
/// 存储项的索引值
/// 存储的对象
///
/// 仅针对存在存储项,若不存在,则不进行任何操作
///
void Set(int index, object @value);
///
/// 移除存储项
///
/// 存储项的健值
void Remove(string key);
///
/// 在指定的位置移除存储项
///
/// 存储项的索引值
void RemoveAt(int index);
///
/// 判断存储器中是否包含指定健值的存储项
///
/// 存储项的健值
/// 是/否
bool Contains(string key);
///
/// 清除此存储器中所有的项
///
void Clear();
///
/// 获得此存储器中所有项的健值
///
/// 健值列表(数组)
string[] GetAllKeys();
///
/// 获取此存储器中所有项的值
///
/// 存储项列表(数组)
object[] GetAllValues();
}
}