public class CacheManager extends Object
Cache
s. Most users will want the use
the get()
and get(String)
methods to retrieve Cache instances, since those
methods are guaranteed to return non-null
caches.Modifier and Type | Method and Description |
---|---|
static void |
clearAll()
Remove all non-default instances and clear the default instance.
|
static void |
clearAndRemoveAll()
Remove all non-default instances and clear the default instance.
|
static Cache |
get()
Get the default cache instance.
|
static Cache |
get(String name)
Get the cache instance for the given cache name.
|
static Cache |
getDefault()
Get the default cache instance.
|
static Cache |
getNamed(String name)
Get the cache instance for the given name.
|
static Cache |
getThreadLocal()
Get the cache instance for the current thread.
|
static void |
removeNamed(String name)
Removes a previously registered named instance.
|
static void |
removeThreadLocal()
Remove a previously registered thread local Cache instance.
|
static void |
setDefault(Cache cache) |
static void |
setNamed(String name,
Cache cache)
Set the cache instance to return for requests for the named instance with the given name.
|
static void |
setThreadLocal(Cache cache)
Set the Cache instance to be used for the current thread, when no specific named instance is
requested.
|
public static Cache get(String name)
get()
.name
- Specifies a previously assigned cache name.get()
. Never returns null
public static Cache get()
null
cache.public static Cache getNamed(String name)
null
, if no such instance has
been registered before. In contrast to get(String)
, this method does not fall back to
thread local or default instances.name
- Specifies a previously assigned cache name.get(String)
. May return
null
.public static void setNamed(String name, Cache cache)
public static void removeNamed(String name)
name
- the previously associated name to the instance to remove.public static Cache getThreadLocal()
null
, if no thread local
instance has been registered before. In contrast to get()
, this method does not fall
back to the default instance.Cache
instance associated to current thread.public static void setThreadLocal(Cache cache)
cache
- the associated Cache
instance.public static void removeThreadLocal()
public static Cache getDefault()
null
cache.public static void setDefault(Cache cache)
cache
- The default Cache
instance.public static void clearAll()
public static void clearAndRemoveAll()
Copyright © 2024 levigo holding gmbh. All rights reserved.