All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.holmos.cache.config.CacheConfigComponent Maven / Gradle / Ivy

package com.holmos.cache.config;

import java.util.ArrayList;

import com.holmos.cache.store.CacheStoreMedia;

/**
 * 缓存配置组件,holmos-cache系统是一个多层缓存方案,这个类相当于一个(一层)缓存的配置项,在缓存参数配置文件里面:
 * 
 * 
  • 如果是.xml类型配置文件,则是介于<cache> 节点之间的配置项
  • *
  • 如果是.properties类型配置文件,就是以holmos.cache.xxx后边的为分割中间的部分
  • * * @author 吴银龙([email protected]) * * * */ public class CacheConfigComponent { /**缓存的名字,在整个holmos-cache系统里面,这个字段应保持唯一*/ private String name; /**缓存类型,缓存的类名*/ private String cacheType; /**存储媒介*/ private String storeMedia; /**缓存的容量,单位B*/ private long maxSize; /**缓存的淘汰策略,缓存淘汰策略的类名*/ private String outPolicy; /**缓存数据的生存时间*/ private long livingTime; /**缓存数据的实效时间*/ private long idleTime; /**该缓存所处的层次,based 1,层次越高,缓存越大,速度越慢,比如,JVM内存一般层数为1,bigMemory为2,磁盘为3等等*/ private int layer; /**定时清理缓存开关,如果为false则不扫描,如果为true则实行定时扫描*/ private boolean scanOnTimeTrigger; /**定时清理扫描时间间隔,单位(ms),只有在scanOnTimeTrigger 值为true的情况下有效*/ private long scanOnTimeInterval; /**当缓存空间满的时候,一次性从缓存里面淘汰的数据的最小size,单位(B)*/ private long freesizeOneTime; /**加载cache配置文件的监听者列表,在加载缓存配置文件的过程中触发*/ private ArrayList cacheConfigListeners; /**缓存监听器列表,在缓存生命周期的过程触发*/ private ArrayList cacheListeners; /**缓存元素操作监听器列表,访问缓存元素的时候触发*/ private ArrayList accessElementListeners; /**指示该层缓存是否有效,如果为false那么该层缓存在系统中没有生效*/ private boolean valid; /**操作系统位数,与JDK位数配套*/ private byte operation_bit; public String getName() { return name; } public void setName(String name) { this.name = name; } public long getMaxSize() { return maxSize; } public void setMaxSize(long maxSize) { this.maxSize = maxSize; } public String getOutPolicy() { return outPolicy; } public void setOutPolicy(String outPolicy) { this.outPolicy = outPolicy; } public long getLivingTime() { return livingTime; } public void setLivingTime(long livingTime) { this.livingTime = livingTime; } public long getIdleTime() { return idleTime; } public void setIdleTime(long idleTime) { this.idleTime = idleTime; } public int getLayer() { return layer; } public void setLayer(int layer) { this.layer = layer; } public boolean isScanOnTimeTrigger() { return scanOnTimeTrigger; } public void setScanOnTimeTrigger(boolean scanOnTimeTrigger) { this.scanOnTimeTrigger = scanOnTimeTrigger; } public long getScanOnTimeInterval() { return scanOnTimeInterval; } public void setScanOnTimeInterval(long scanOnTimeInterval) { this.scanOnTimeInterval = scanOnTimeInterval; } public long getFreesizeOneTime() { return freesizeOneTime; } public void setFreesizeOneTime(long freesizeOneTime) { this.freesizeOneTime = freesizeOneTime; } public String getCacheType() { return cacheType; } public void setCacheType(String cacheType) { this.cacheType = cacheType; } public ArrayList getCacheConfigListeners() { return cacheConfigListeners; } public void addCacheConfigListener(String cacheConfigListener) { this.cacheConfigListeners.add(cacheConfigListener); } public void removeCacheConfigListener(String cacheConfigListener){ this.cacheConfigListeners.remove(cacheConfigListener); } public void clearCacheConfigListeners(){ this.cacheConfigListeners.clear(); } public ArrayList getCacheListeners() { return cacheListeners; } public void addCacheListeners(String cacheListener) { this.cacheListeners.add(cacheListener); } public void removeCacheListeners(String cacheListener) { this.cacheListeners.remove(cacheListener); } public void clearCacheListeners() { this.cacheListeners.clear(); } public ArrayList getAccessElementListeners() { return accessElementListeners; } public void addAccessElementListener(String accessElementListener) { this.accessElementListeners.add(accessElementListener); } public void removeAccessElementListener(String accessElementListener) { this.accessElementListeners.remove(accessElementListener); } public void clearAccessElementListeners() { this.accessElementListeners.clear(); } public boolean isValid() { return valid; } public void setValid(boolean valid) { this.valid = valid; } public CacheStoreMedia getStoreMedia() { return CacheStoreMedia.valueOf(storeMedia); } public void setStoreMedia(String storeMedia) { this.storeMedia = storeMedia; } public byte getOperation_bit() { return operation_bit; } public void setOperation_bit(byte operation_bit) { this.operation_bit = operation_bit; } }




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy