1 11 package org.jivesoftware.util; 12 13 import java.util.*; 14 15 21 public class CacheManager { 22 23 private static Map caches = new HashMap(); 24 private static long maxLifetime = JiveConstants.HOUR * 6; 25 26 39 public static void initializeCache(String name, int defaultMaxCacheSize) { 40 Cache cache = (Cache)caches.get(name); 41 if (cache == null) { 42 int maxCacheSize = JiveGlobals.getIntProperty("cache." + name + ".size", defaultMaxCacheSize); 43 caches.put(name, new Cache(name, maxCacheSize, maxLifetime)); 44 } 45 } 46 47 53 public static Cache getCache(String name) { 54 return (Cache)caches.get(name); 55 } 56 } | Popular Tags |