类 BeanSafeCache<T>
java.lang.Object
cn.dinodev.spring.commons.bean.BeanSafeCache<T>
- 作者:
- Cody Lu
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidacceptClassLoader(ClassLoader classLoader) Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults class.voidclearClassLoader(ClassLoader classLoader) Clear the introspection cache for the given ClassLoader, removing the introspection results for all classes underneath that ClassLoader, and removing the ClassLoader (and its children) from the acceptance list.Retrieve a cached infofor the given target class. Retrieve a cached infofor the given target class. booleanisClassLoaderAccepted(ClassLoader classLoader) Check whether this CachedIntrospectionResults class is configured to accept the given ClassLoader.Associates the specified value with the specified key in this cache.remove the specified key in this cache.
-
构造器详细资料
-
BeanSafeCache
public BeanSafeCache()
-
-
方法详细资料
-
acceptClassLoader
Accept the given ClassLoader as cache-safe, even if its classes would not qualify as cache-safe in this CachedIntrospectionResults class.This configuration method is only relevant in scenarios where the Spring classes reside in a 'common' ClassLoader (e.g. the system ClassLoader) whose lifecycle is not coupled to the application. In such a scenario, CachedIntrospectionResults would by default not cache any of the application's classes, since they would create a leak in the common ClassLoader.
Any
acceptClassLoadercall at application startup should be paired with aclearClassLoader(java.lang.ClassLoader)call at application shutdown.- 参数:
classLoader- the ClassLoader to accept
-
clearClassLoader
Clear the introspection cache for the given ClassLoader, removing the introspection results for all classes underneath that ClassLoader, and removing the ClassLoader (and its children) from the acceptance list.- 参数:
classLoader- the ClassLoader to clear the cache for
-
isClassLoaderAccepted
Check whether this CachedIntrospectionResults class is configured to accept the given ClassLoader.- 参数:
classLoader- the ClassLoader to check- 返回:
- whether the given ClassLoader is accepted
- 另请参阅:
-
get
Retrieve a cached infofor the given target class. - 参数:
beanClass- the target class to introspect- 返回:
- the resulting cached info
(never null)
-
getOrElse
Retrieve a cached infofor the given target class. - 参数:
beanClass- the target class to introspect- 返回:
- the resulting cached info
(never null)
-
put
Associates the specified value with the specified key in this cache.- 参数:
beanClass-info-- 返回:
- the previous value associated with key, or null if there was no mapping for key.
-
remove
remove the specified key in this cache.- 参数:
beanClass-- 返回:
- the previous value associated with key, or null if there was no mapping for key.
-