cacheutils.jsp
来自「Jive是基于JSP/JAVA技术构架的一个大型BBS论坛系统,这是Jive论坛」· JSP 代码 · 共 173 行
JSP
173 行
<%/** * $RCSfile: cacheUtils.jsp,v $ * $Revision: 1.7 $ * $Date: 2002/08/09 21:35:10 $ */%><%@ page import="java.util.*, java.text.*, com.jivesoftware.util.*, com.jivesoftware.forum.*, com.jivesoftware.forum.database.*, com.jivesoftware.forum.util.*, com.tangosol.net.*"%><%! // global variables // variable for the VM memory monitor box: static final int NUM_BLOCKS = 50; // Cache size preset definitions: static final int CACHE_PRESET_SMALL = 0; static final int CACHE_PRESET_MEDIUM = 1; static final int CACHE_PRESET_LARGE = 2; static final int CACHE_PRESET_CUSTOM = 3; // Cache size preset names: static final String[] CACHE_PRESET_NAMES = { "Small", "Medium", "Large", "Custom" }; // Cache size preset descriptions: static final String[] CACHE_PRESET_DESCRIPTIONS = { "Suitable for workgroups or small to medium communities. (Approx 4 MB total cache)", "Suitable for medium to large communities. (17 MB total cache)", "Suitable for very large communities on servers with a lot of memory. (65 MB total cache)", "Use this option to be able to edit each of the cache sizes below." };%><% // Get a db forum factory instance: DbForumFactory dbForumFactory = DbForumFactory.getInstance(); // Get a cache manager: DatabaseCacheManager cacheManager = dbForumFactory.getCacheManager(); int numCaches = 11; // all caches if (!cacheManager.isShortTermQueryCacheEnabled()) { // don't show the query cache unless it is enabled: numCaches = 10; } // Various cache arrays int[][] cachePresetSizes = null; Cache[] caches = null; String[] names = null; if (cacheManager.isShortTermQueryCacheEnabled() && isEnt) { // Preset mem sizes (in bytes): // SMALL MEDIUM LARGE cachePresetSizes = new int[][] { { 256*1024, 512*1024, 1024*1024 }, /* Category */ { 512*1024, 1024*1024, 5120*1024 }, /* Forum */ { 512*1024, 3072*1024, 10240*1024 }, /* Thread */ { 1152*1024, 8192*1024, 32768*1024 }, /* Message */ { 512*1024, 1024*1024, 2048*1024 }, /* Category Query */ { 128*1024, 256*1024, 512*1024 }, /* Short Term Query */ { 512*1024, 1024*1024, 6144*1024 }, /* User */ { 256*1024, 768*1024, 4608*1024 }, /* User Permissions */ { 128*1024, 256*1024, 512*1024 }, /* Group */ { 16*1024, 32*1024, 64*1024 }, /* Group Membership */ { 128*1024, 256*1024, 512*1024 } /* Watches */ }; // Get a list of caches: caches = new Cache[] { cacheManager.categoryCache, cacheManager.forumCache, cacheManager.threadCache, cacheManager.messageCache, cacheManager.queryCache, cacheManager.shortTermQueryCache, cacheManager.userCache, cacheManager.userPermsCache, cacheManager.groupCache, cacheManager.groupMemberCache, cacheManager.watchCache }; // Get a list of caches: names = new String[] { "categoryCache", "forumCache", "threadCache", "messageCache", "queryCache", "shortTermQueryCache", "userCache", "userPermsCache", "groupCache", "groupMemberCache", "watchCache" }; } else { // Preset mem sizes (in bytes): // SMALL MEDIUM LARGE cachePresetSizes = new int[][] { { 256*1024, 512*1024, 1024*1024 }, /* Category */ { 512*1024, 1024*1024, 5120*1024 }, /* Forum */ { 512*1024, 3072*1024, 10240*1024 }, /* Thread */ { 1152*1024, 8192*1024, 32768*1024 }, /* Message */ { 512*1024, 1024*1024, 2048*1024 }, /* Category Query */ { 512*1024, 1024*1024, 6144*1024 }, /* User */ { 256*1024, 768*1024, 4608*1024 }, /* User Permissions */ { 128*1024, 256*1024, 512*1024 }, /* Group */ { 16*1024, 32*1024, 64*1024 }, /* Group Membership */ { 128*1024, 256*1024, 512*1024 } /* Watches */ }; // Get a list of caches: caches = new Cache[] { cacheManager.categoryCache, cacheManager.forumCache, cacheManager.threadCache, cacheManager.messageCache, cacheManager.queryCache, cacheManager.userCache, cacheManager.userPermsCache, cacheManager.groupCache, cacheManager.groupMemberCache, cacheManager.watchCache }; // Get a list of caches: names = new String[] { "categoryCache", "forumCache", "threadCache", "messageCache", "queryCache", "userCache", "userPermsCache", "groupCache", "groupMemberCache", "watchCache" }; } // List of the cache names String[] cacheNames = new String[caches.length]; for (int i=0; i<caches.length; i++) { cacheNames[i] = caches[i].getName(); } // decimal formatter for cache values DecimalFormat mbFormat = new DecimalFormat("#0.00"); DecimalFormat kFormat = new DecimalFormat("#"); DecimalFormat percentFormat = new DecimalFormat("#0.0");%><%! static boolean isEnt = false; static { try { LicenseManager.validateLicense("Jive Forums Enterprise","2.0"); isEnt = true; } catch (Exception ignored) {} }%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?