|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PublicApi public interface CacheFactory
Interface for creating and/or attaching to caches. Caches are identified by name, and two caches with the same name always refer to the same backing structure.
This factory and its builders hide many of the implementation details of any cache. The only real control you have is whether it is a local (JVM-local) or shared cache. All of the following maybe be different in some execution environments, so you should not assume any of them in your code:
Cache
,
CacheManager
Method Summary | ||
---|---|---|
|
getCache(Class<?> owningClass,
String name)
Returns the cache with the given name, creates it if necessary. |
|
|
getCache(String name)
Returns the cache with the given name, creates it if necessary. |
|
|
getCache(String name,
CacheLoader<K,V> loader)
Returns the cache with the given name and loader, creates it if necessary. |
|
|
getCache(String name,
CacheLoader<K,V> loader,
CacheSettings required)
Returns the cache with the given name, loader and required cache settings, creates it if necessary. |
|
|
getCache(String name,
Class<K> keyType,
Class<V> valueType)
Deprecated. since 2.0, use getCache(name) instead |
|
|
getCachedReference(Class<?> owningClass,
String name,
Supplier<V> supplier)
Returns a Cached Reference, creating it if necessary. |
|
|
getCachedReference(Class<?> owningClass,
String name,
Supplier<V> supplier,
CacheSettings required)
Returns a Cached Reference, creating it if necessary. |
|
|
getCachedReference(String name,
Supplier<V> supplier)
Returns a Cached Reference, creating it if necessary. |
|
|
getCachedReference(String name,
Supplier<V> supplier,
CacheSettings required)
Returns a Cached Reference, creating it if necessary. |
Method Detail |
---|
<V> CachedReference<V> getCachedReference(@NotNull String name, @NotNull Supplier<V> supplier)
name
- the name of the Cached Referencesupplier
- the supplier for value to be cached, called if the value needs to be generated
<V> CachedReference<V> getCachedReference(@NotNull String name, @NotNull Supplier<V> supplier, @NotNull CacheSettings required)
name
- the name of the Cached Referencesupplier
- the supplier for value to be cached, called if the value needs to be generatedrequired
- specifies the required cache settings
<V> CachedReference<V> getCachedReference(@NotNull Class<?> owningClass, @NotNull String name, @NotNull Supplier<V> supplier)
It is equivalent to calling getCachedReference(String, Supplier, CacheSettings)
owningClass
- the owning classname
- the name of the cache spaced within the owningClasssupplier
- the supplier for value to be cached, called if the value needs to be generated
<V> CachedReference<V> getCachedReference(@NotNull Class<?> owningClass, @NotNull String name, @NotNull Supplier<V> supplier, @NotNull CacheSettings required)
It is equivalent to calling getCachedReference(String, Supplier, CacheSettings)
owningClass
- the owning classname
- the name of the cache spaced within the owningClasssupplier
- the supplier for value to be cached, called if the value needs to be generatedrequired
- specifies the required cache settings
<K,V> Cache<K,V> getCache(@NotNull String name)
getCache(String, CacheLoader)
with name and null.
name
- the name of the cache
<K,V> Cache<K,V> getCache(@NotNull Class<?> owningClass, @NotNull String name)
It is equivalent to calling getCache(String)
with the computed name.
owningClass
- the owning classname
- the name of the cache spaced within the owningClass
<K,V> Cache<K,V> getCache(@NotNull String name, CacheLoader<K,V> loader)
getCache(String, CacheLoader, CacheSettings)
with name, null and new CacheSettingsBuilder().build().
name
- the name of the cacheloader
- the loader that will be used to provide values for keys that will be added to the cache. null indicates no loader
<K,V> Cache<K,V> getCache(@NotNull String name, CacheLoader<K,V> loader, @NotNull CacheSettings required)
name
- the name of the cacheloader
- the loader that will be used to provide values for keys that will be added to the cache. null indicates no loaderrequired
- the cache settings that are required to be set if the cache is created.
@Deprecated <K,V> Cache<K,V> getCache(@NotNull String name, @NotNull Class<K> keyType, @NotNull Class<V> valueType)
name
- the name of the cachekeyType
- the type of keys in the cache. Must extend SerializablevalueType
- the type of values in the cache. Must extend Serializable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |