⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 icache.java

📁  EasyDBO是一个超轻量级对象-关系映射(Object/Relation Mapping
💻 JAVA
字号:
package com.easyjf.cache;

//~--- JDK imports ------------------------------------------------------------

import java.util.*;

//~--- interfaces -------------------------------------------------------------
/**
 * 
 * <p>
 * Title:缓存接口类
 * </p>
 * 
 * <p>
 * Description:定义缓存的基本操作接口
 * </p>
 * 
 * <p>
 * Copyright: Copyright (c) 2006
 * </p>
 * 
 * <p>
 * Company: EasyJF开源团队-EasyDBO项目组
 * </p>
 * 
 * @author 蔡世友
 * @version 1.0
 */
public interface ICache extends Cloneable {

	/**
	 * 清除缓存中所有元素,但保留缓存在可用状态
	 * 
	 * @throws CacheException
	 *             缓存异常
	 */
	public void clear() throws CacheException;

	/**
	 * 
	 * @return Object
	 * @throws CloneNotSupportedException
	 */
	public Object clone() throws CloneNotSupportedException;

	/**
	 * 清除缓存,并使之不可用
	 * 
	 * @throws CacheException
	 *             缓存异常
	 */
	public void destroy() throws CacheException;

	/**
	 * 未实现方法 Calls to this method should perform there own synchronization. It
	 * is provided for distributed caches. Because EHCache is not distributed
	 * this method does nothing.
	 * 
	 * @param key
	 *            元素键值
	 * @throws CacheException
	 *             缓存异常
	 */
	public void lock(Object key) throws CacheException;

	/**
	 * 放置对象到缓存中
	 * 
	 * @param key
	 *            Object 可序列化的键值
	 * @param value
	 *            Object 可序列化的元素值
	 * @throws CacheException
	 *             缓存异常
	 */
	public void put(Object key, Object value) throws CacheException;

	/**
	 * 清除匹配键值的元素值
	 * <p>
	 * 如果没有元素匹配,则没有清除动作且不抛出任何异常
	 * 
	 * @param key
	 *            需要清除的元素键值
	 * @throws CacheException
	 *             缓存异常
	 */
	public void remove(Object key) throws CacheException;

	public void removeElement(Object value);

	/**
	 * 未实现方法 Calls to this method should perform there own synchronization. It
	 * is provided for distributed caches. Because EHCache is not distributed
	 * this method does nothing.
	 * 
	 * @param key
	 *            元素键值
	 * @throws CacheException
	 *             缓存异常
	 */
	public void unlock(Object key) throws CacheException;

	// ~--- get methods --------------------------------------------------------

	/**
	 * 获得匹配指定键值的元素值
	 * 
	 * @param key
	 *            Object 返回元素的键值
	 * @return Object 之前放入缓存的元素值,如果找不到或者过期则为null
	 * @throws CacheException
	 *             缓存异常
	 */
	public Object get(Object key) throws CacheException;

	/**
	 * 获得Element中元素数量
	 * 
	 * @return int
	 */
	public int getElementCount();

	/**
	 * 
	 * @return Set
	 */
	public Set getKeySet();

	/**
	 * 获得Element容纳元素的最大数量
	 * 
	 * @return int
	 */
	public int getMaxElemnetCount();

	/**
	 * 
	 * @return String
	 */
	public String getName();

	/**
	 * 获得内存中元素数量
	 * 
	 * @return 内存中元素数量,如果不明异常返回-1
	 */
	public long getSize();

	//public void setSize(long size);
	/**
	 * 获取缓存方案
	 * 
	 * @return int
	 */
	public int getStorePolicy();

	public void setStorePolicy(int storePolicy);
	/**
	 * 是否过期
	 * 
	 * @param e
	 *            Element
	 * @return boolean
	 */
	public boolean isExpired(Element e);

	// ~--- set methods --------------------------------------------------------

	/**
	 * 
	 * @param name
	 *            String
	 */
	public void setName(String name);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -