public CachePolicy createCachePolicy() { return new LRUCachePolicy(min, max); } }
public ClassReaderCache createCache() { CachePolicy policy = null; if (policyClass == TimedCachePolicy.class) policy = new TimedCachePolicy(lifetime, true, resolution); else if (policyClass == LRUCachePolicy.class) policy = new LRUCachePolicy(min, max); else { try { policy = policyClass.newInstance(); } catch(Exception e) { throw new IllegalStateException("Could not instantiate " + policyClass.getName(), e); } } try { policy.create(); policy.start(); } catch(Exception e) { throw new IllegalStateException("Error starting domain cache", e); } return new ClassReaderCache(policy); }
public CtClassCache createCache() { CachePolicy policy = null; if (policyClass == TimedCachePolicy.class) policy = new TimedCachePolicy(lifetime, true, resolution); else if (policyClass == LRUCachePolicy.class) policy = new LRUCachePolicy(min, max); else { try { policy = policyClass.newInstance(); } catch(Exception e) { throw new IllegalStateException("Could not instantiate " + policyClass.getName(), e); } } try { policy.create(); policy.start(); } catch(Exception e) { throw new IllegalStateException("Error starting domain cache", e); } return new CtClassCache(policy); }