14.3.2.3.3. Add a Producer Class
The following code snippet illustrates how the
@SmallCache
qualifier (created in the previous step) specifies a way to create a cache:
import org.infinispan.configuration.cache.Configuration; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.cdi.ConfigureCache; import javax.enterprise.inject.Proces; public class CacheCreator { @ConfigureCache("smallcache") @SmallCache @Produces public Configuration specialCacheCfg() { return new ConfigurationBuilder() .eviction() .strategy(EvictionStrategy.LRU) .maxEntries(10) .build(); } }
The elements in the code snippet are:
@ConfigureCache
specifies the name of the cache.@SmallCache
is the cache qualifier.