类 DSContext
java.lang.Object
com.sh.javax.util.DSContext
Description: 数据查询缓存管理工具(一级缓存),对于使用大字段类型的,不要使用缓存技术,
DS数据行数到达一定值时会自运转到二级缓存(通过参数toCache2RowCount配置)
Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
-
嵌套类概要
嵌套类 -
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidstatic void清空缓存,并发出通知protected static void清空所有缓存protected static voidclearReally(String key) 清除特定值static String获取该缓存中变量加入的次数static Datastore获取缓存DS对象static int获取缓存周期static intstatic voidstatic StringprocessKey(DataCenter dc, String sql, String key, String[] colsType, Object[] obj) 生成键值static StringprocessKey(String sql, String key, String[] colsType, Object[] obj) static void添加对象static voidsetDsCacheTimeout(int timeToLiveSeconds) 已过时。static voidsetLogEnable(boolean logEnable) 设置是否记录日志static voidsetMaxElementsInMemory(int maxElementsInMemory) 设置最大缓存数static voidsetTimeToLiveSeconds(int timeToLiveSeconds) 设置缓存时长static voidsetToCache2RowCount(int toCache2RowCount) protected static voidupdateCache(String sql) 已过时。static voidupdateCacheByTableName(String tableName) static voidupdateCacheByTableName(List<String> tableNameList) protected static voidupdateCacheByTableNameReally(String tableName) protected static voidupdateCacheByTableNameReally(List<String> tableNameList) static voidupdateTableAndNotify(String tableName) protected static voidupdateTableReally(String tableName) 刷新表对应的缓存
-
字段详细资料
-
logEnable
public static boolean logEnable -
storeColsTypeList
-
-
构造器详细资料
-
DSContext
public DSContext()
-
-
方法详细资料
-
processKey
-
processKey
public static String processKey(DataCenter dc, String sql, String key, String[] colsType, Object[] obj) 生成键值- 参数:
dc- DataCentersql- SQLkey- StringcolsType- 参数类型obj- 参数值- 返回:
- String
-
put
添加对象- 参数:
key- Stringds- Datastore
-
clear
-
clearReally
清除特定值- 参数:
key-
-
clearCache
public static void clearCache()清空缓存,并发出通知 -
clearCacheReally
protected static void clearCacheReally()清空所有缓存 -
getDs
获取缓存DS对象- 参数:
key- 关键字,一般为SQL- 返回:
- Datastore
-
setTimeToLiveSeconds
public static void setTimeToLiveSeconds(int timeToLiveSeconds) 设置缓存时长- 参数:
timeToLiveSeconds- int
-
setDsCacheTimeout
已过时。不明原因,不加此方法无法混淆(最开始是此方法,后面已经不再使用了)- 参数:
timeToLiveSeconds- int
-
getTimeToLiveSeconds
public static int getTimeToLiveSeconds()获取缓存周期- 返回:
- int
-
setLogEnable
public static void setLogEnable(boolean logEnable) 设置是否记录日志- 参数:
logEnable- true|false,默认false
-
setMaxElementsInMemory
public static void setMaxElementsInMemory(int maxElementsInMemory) 设置最大缓存数- 参数:
maxElementsInMemory- 最大允许缓存数
-
getCacheDetail
获取该缓存中变量加入的次数- 返回:
- String
-
getToCache2RowCount
public static int getToCache2RowCount() -
setToCache2RowCount
public static void setToCache2RowCount(int toCache2RowCount) -
updateCacheByTableName
-
updateCacheByTableNameReally
-
updateCacheByTableName
-
updateCacheByTableNameReally
-
updateCache
已过时。解析SQL,目前支持以下几种形式 //INSERT INTO TABLENAME //UPDATE TABLENAME //DELETE TABLENAME //DELETE FROM TABLENAME- 参数:
sql-
-
updateTableAndNotify
-
updateTableReally
刷新表对应的缓存- 参数:
tableName- 表名
-
main
-