- Common ways to obtain CacheFactory
private void myMethod () {}
public org.picocontainer.web.Cache provide() throws CacheException { CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); final javax.cache.Cache jCache = cacheFactory.createCache(props); return new org.picocontainer.web.Cache() { public Object get(Object key) { return jCache.get(key); } public void put(Object key, Object toCache) { jCache.put(key, toCache); } }; } }
public com.picocontainer.web.Cache provide() throws CacheException { CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); final javax.cache.Cache jCache = cacheFactory.createCache(props); return new com.picocontainer.web.Cache() { public Object get(Object key) { return jCache.get(key); } public void put(Object key, Object toCache) { jCache.put(key, toCache); } }; } }
private Cache initialiseJCache() { try { CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory(); Cache cache = cacheFactory.createCache(Collections.emptyMap()); return cache; } catch (CacheException e) { throw new InjectionException(e, "Failed to initialise %s: %s", Cache.class.getName(), e.getMessage()); } } }