程序包 com.sh.util
类 ContextUtil
java.lang.Object
com.sh.common.util.SHUtils
com.sh.util.ContextUtil
首亨软件 - CRM、TSS、ERP等信息化管理软件
-
字段概要
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidprotected static void清空所有缓存static booleancontainKey(String key) 判断是否包含关键字static Object通过键获取相应的值static CheckBoxGroupgetCheckBoxGroup(String key) 通过键获取相应的值static DatastoregetDatastore(String key) 通过键获取相应的值static Date通过键获取相应的值static Double通过键获取相应的值static doublegetDouble2(String key) static IntegergetInteger(String key) 通过键获取相应的值static intgetInteger2(String key) static intgetInteger2(String key, int defaultValue) static Long通过键获取相应的值static longstatic longstatic int获取最大缓存数static OptionsgetOptions(String key) 通过键获取相应的值static String通过键获取相应的值static StringgetString2(String key) static StringgetStringAndRemove(String key) static Thread通过键获取相应的值static TimestampgetTimestamp(String key) 通过键获取相应的值static int获取生命周期static long获取过期时间static void添加值到缓存static void添加值到缓存static voidstatic voidputRefresh(String key, Object value) static voidstatic voidremoveByStartsKey(String key) protected static void删除以key开头的缓存protected static voidremoveReally(String key) 删除缓存变量static voidsetMaxElementsInMemory(int maxElementsInMemory) 设置最大缓存数static voidsetTimeToLiveSeconds(int timeToLiveSeconds) 设置缓存时长从类继承的方法 com.sh.common.util.SHUtils
getDeptAllUser, getRequest, getResponse, getRoleDeptUser, isAjaxQuery, isAjaxQuery, isContain
-
构造器详细资料
-
ContextUtil
public ContextUtil()
-
-
方法详细资料
-
setTimeToLiveSeconds
public static void setTimeToLiveSeconds(int timeToLiveSeconds) 设置缓存时长- 参数:
timeToLiveSeconds- 单位:秒
-
getTimeToLiveSeconds
public static int getTimeToLiveSeconds()获取生命周期- 返回:
- int
-
setMaxElementsInMemory
public static void setMaxElementsInMemory(int maxElementsInMemory) 设置最大缓存数- 参数:
maxElementsInMemory- 最大允许缓存数
-
getMaxElementsInMemory
public static int getMaxElementsInMemory()获取最大缓存数- 返回:
- int
-
put
-
put
添加值到缓存- 参数:
key- 键value- 值forever- 是否永久有效
-
containKey
判断是否包含关键字- 参数:
key- 关键字- 返回:
- boolean
-
put
添加值到缓存- 参数:
key- 键value- 值
-
putRefresh
-
get
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
remove
-
removeReally
删除缓存变量- 参数:
key- 键
-
removeByStartsKey
-
removeByStartsKeyReally
删除以key开头的缓存- 参数:
key-
-
clearCache
public static void clearCache() -
clearCacheReally
protected static void clearCacheReally()清空所有缓存 -
getString
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getStringAndRemove
-
getString2
-
getOptions
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getCheckBoxGroup
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getInteger
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getInteger2
-
getInteger2
-
getLong
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getLong2
-
getLong2
-
getDouble
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getDouble2
-
getDatastore
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getDate
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getTimestamp
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getThread
通过键获取相应的值- 参数:
key- 键- 返回:
- 获取缓存中的值,没有找到时返回null
-
getTTL
获取过期时间- 参数:
key-- 返回:
-