javax.cache
Interface CacheBuilder<K,V>

Type Parameters:
K - the key type
V - the value type

public interface CacheBuilder<K,V>

A CacheBuilder is used for creating Caches. A CacheBuilder is created by CacheManager.createCacheBuilder(String) and is associated with that manager.

Since:
1.7
Author:
Yannis Cosmadopoulos

Method Summary
 Cache<K,V> build()
          Create an instance of the named Cache.
 CacheBuilder<K,V> setCacheConfiguration(CacheConfiguration configuration)
          Set the cache configuration.
 CacheBuilder<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader)
          Set the cache loader.
 

Method Detail

build

Cache<K,V> build()
Create an instance of the named Cache.

The Cache will be created, added to the caches controlled by its associated CacheManager and started. If there is an existing Cache of the same name associated with this CacheManager when build is invoked, the old Cache will be stopped.

Returns:
a new instance of the named cache
Throws:
InvalidConfigurationException - thrown if the configuration is invalid
See Also:
CacheManager.createCacheBuilder(String)

setCacheConfiguration

CacheBuilder<K,V> setCacheConfiguration(CacheConfiguration configuration)
Set the cache configuration.

Parameters:
configuration - the cache configuration
Returns:
the builder

setCacheLoader

CacheBuilder<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader)
Set the cache loader.

Parameters:
cacheLoader - the CacheLoader
Returns:
the builder


Copyright © 2011. All Rights Reserved.