@PostConstruct public void initialize() { if ( this.applicationContext.containsBean( "cache#default" ) ) { this.defaultCache = this.applicationContext.getBean( "cache#default", Cache.class ); } else { log.info( "Cache with role-hint default doesn't exists, default will be no cache" ); this.defaultCache = new NoCacheCache(); } }
public Cache getCache( String id, CacheHints hints ) throws CacheException { if ( creator == null ) { return new NoCacheCache(); } if ( caches.containsKey( id ) ) { return (Cache) caches.get( id ); } if ( hints == null ) { // Setup some defaults. hints = new CacheHints(); hints.setName( id ); } Cache cache = CacheFactory.creator.createCache( hints ); caches.put( id, cache ); return (Cache) cache; } }
public Cache getCache( String id, CacheHints hints ) throws CacheException { if ( creator == null ) { return new NoCacheCache(); } if ( caches.containsKey( id ) ) { return (Cache) caches.get( id ); } if ( hints == null ) { // Setup some defaults. hints = new CacheHints(); hints.setName( id ); } Cache cache = CacheFactory.creator.createCache( hints ); caches.put( id, cache ); return (Cache) cache; } }
public void initialize() throws InitializationException { if ( this.plexusContainer.hasComponent( Cache.ROLE, "default" ) ) { try { this.defaultCache = (Cache) this.plexusContainer.lookup( Cache.ROLE, "default" ); } catch ( ComponentLookupException e ) { String emsg = "error during lookup of Cache with role-hint default "; getLogger().warn( emsg, e ); throw new InitializationException( emsg, e ); } } else { getLogger().info( "Cache with role-hint default doesn't exists, default will be no cache" ); this.defaultCache = new NoCacheCache(); } }