Package net.solarnetwork.central.support
Class JCacheFactoryBean<K,V>
java.lang.Object
net.solarnetwork.central.support.JCacheFactoryBean<K,V>
- All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<javax.cache.Cache<K,,V>> org.springframework.beans.factory.InitializingBean
public class JCacheFactoryBean<K,V>
extends Object
implements org.springframework.beans.factory.FactoryBean<javax.cache.Cache<K,V>>, org.springframework.beans.factory.InitializingBean
Factory bean for
Cache instances.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCache expiry policy type. -
Field Summary
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE -
Constructor Summary
ConstructorsConstructorDescriptionJCacheFactoryBean(javax.cache.CacheManager cacheManager, Class<K> keyType, Class<V> valueType) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidClass<?> booleanGet the disk persistence setting.booleanvoidsetDiskMaxSizeMB(Integer diskMaxSizeMB) Set the maximum size, in MB, to store on disk.voidsetDiskPersistent(boolean diskPersistent) Set the disk persistence setting.voidsetExpiryDuration(javax.cache.expiry.Duration expiryDuration) Set the expiry duration.voidsetExpiryPolicy(JCacheFactoryBean.ExpiryPolicy expiryPolicy) Set the expiry policy.voidsetHeapMaxEntries(Integer heapMaxEntries) Set the maximum entries to store in main memory.voidSet the cache name.voidsetReadThrough(boolean readThrough) Set the read-through flag.voidsetReadThroughLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> readThroughLoaderFactory) Set the read-through loader factory.voidsetStatisticsEnabled(boolean statisticsEnabled) Set the statistics-enabled flag.voidsetStoreByValue(boolean storeByValue) Set the store-by-value flag.voidsetWriteThrough(boolean writeThrough) Set the write-through flag.voidsetWriteThroughWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<K, V>> writeThroughWriterFactory) Set the write-through writer factory.
-
Constructor Details
-
Method Details
-
afterPropertiesSet
- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Throws:
Exception
-
getObject
-
getObjectType
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<K>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingletonin interfaceorg.springframework.beans.factory.FactoryBean<K>
-
setName
Set the cache name.- Parameters:
name- the name to set
-
setStoreByValue
public void setStoreByValue(boolean storeByValue) Set the store-by-value flag.- Parameters:
storeByValue- the store-by-value to set
-
setExpiryPolicy
Set the expiry policy.- Parameters:
expiryPolicy- the expiry policy to set
-
setExpiryDuration
public void setExpiryDuration(javax.cache.expiry.Duration expiryDuration) Set the expiry duration.- Parameters:
expiryDuration- the expiry duration to set
-
setReadThrough
public void setReadThrough(boolean readThrough) Set the read-through flag.- Parameters:
readThrough- the read-through to set
-
setWriteThrough
public void setWriteThrough(boolean writeThrough) Set the write-through flag.- Parameters:
writeThrough- the write-through to set
-
setStatisticsEnabled
public void setStatisticsEnabled(boolean statisticsEnabled) Set the statistics-enabled flag.- Parameters:
statisticsEnabled- the statistics-enabled to set
-
setReadThroughLoaderFactory
public void setReadThroughLoaderFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheLoader<K, V>> readThroughLoaderFactory) Set the read-through loader factory.- Parameters:
readThroughLoaderFactory- the loader to set
-
setWriteThroughWriterFactory
public void setWriteThroughWriterFactory(javax.cache.configuration.Factory<? extends javax.cache.integration.CacheWriter<K, V>> writeThroughWriterFactory) Set the write-through writer factory.- Parameters:
writeThroughWriterFactory- the writer to set
-
setHeapMaxEntries
Set the maximum entries to store in main memory.This is an EhCache specific vendor extension, that only works if EhCache is available on the classpath.
- Parameters:
heapMaxEntries- the max heap entries to configure- Since:
- 1.1
-
setDiskMaxSizeMB
Set the maximum size, in MB, to store on disk.This is an EhCache specific vendor extension, that only works if EhCache is available on the classpath.
- Parameters:
diskMaxSizeMB- the max disk size to store- Since:
- 1.1
-
isDiskPersistent
public boolean isDiskPersistent()Get the disk persistence setting.- Returns:
- true if disk storage should be persistent across restarts; defaults to false
- Since:
- 1.2
-
setDiskPersistent
public void setDiskPersistent(boolean diskPersistent) Set the disk persistence setting.- Parameters:
diskPersistent- true if disk storage should be persistent across restarts; defaults to false, false to clear the disk storage on restart- Since:
- 1.2
-