类 DSContext

java.lang.Object
com.sh.javax.util.DSContext

public class DSContext extends Object
Description: 数据查询缓存管理工具(一级缓存),对于使用大字段类型的,不要使用缓存技术, DS数据行数到达一定值时会自运转到二级缓存(通过参数toCache2RowCount配置) Title:首亨软件 - CRM、TSS、ERP等信息化管理软件
  • 字段详细资料

    • logEnable

      public static boolean logEnable
    • storeColsTypeList

      public static final List<String> storeColsTypeList
  • 构造器详细资料

    • DSContext

      public DSContext()
  • 方法详细资料

    • processKey

      public static String processKey(String sql, String key, String[] colsType, Object[] obj)
    • processKey

      public static String processKey(DataCenter dc, String sql, String key, String[] colsType, Object[] obj)
      生成键值
      参数:
      dc - DataCenter
      sql - SQL
      key - String
      colsType - 参数类型
      obj - 参数值
      返回:
      String
    • put

      public static void put(String key, Datastore ds)
      添加对象
      参数:
      key - String
      ds - Datastore
    • clear

      public static void clear(String key)
    • clearReally

      protected static void clearReally(String key)
      清除特定值
      参数:
      key -
    • clearCache

      public static void clearCache()
      清空缓存,并发出通知
    • clearCacheReally

      protected static void clearCacheReally()
      清空所有缓存
    • getDs

      public static Datastore getDs(String key)
      获取缓存DS对象
      参数:
      key - 关键字,一般为SQL
      返回:
      Datastore
    • setTimeToLiveSeconds

      public static void setTimeToLiveSeconds(int timeToLiveSeconds)
      设置缓存时长
      参数:
      timeToLiveSeconds - int
    • setDsCacheTimeout

      @Deprecated public static void setDsCacheTimeout(int timeToLiveSeconds)
      已过时。
      不明原因,不加此方法无法混淆(最开始是此方法,后面已经不再使用了)
      参数:
      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

      public static String getCacheDetail()
      获取该缓存中变量加入的次数
      返回:
      String
    • getToCache2RowCount

      public static int getToCache2RowCount()
    • setToCache2RowCount

      public static void setToCache2RowCount(int toCache2RowCount)
    • updateCacheByTableName

      public static void updateCacheByTableName(String tableName)
    • updateCacheByTableNameReally

      protected static void updateCacheByTableNameReally(String tableName)
    • updateCacheByTableName

      public static void updateCacheByTableName(List<String> tableNameList)
    • updateCacheByTableNameReally

      protected static void updateCacheByTableNameReally(List<String> tableNameList)
    • updateCache

      @Deprecated protected static void updateCache(String sql)
      已过时。
      解析SQL,目前支持以下几种形式 //INSERT INTO TABLENAME //UPDATE TABLENAME //DELETE TABLENAME //DELETE FROM TABLENAME
      参数:
      sql -
    • updateTableAndNotify

      public static void updateTableAndNotify(String tableName)
    • updateTableReally

      protected static void updateTableReally(String tableName)
      刷新表对应的缓存
      参数:
      tableName - 表名
    • main

      public static void main(String[] args)