类 CachingMetadataReaderFactory
java.lang.Object
cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory
cn.taketoday.core.type.classreading.CachingMetadataReaderFactory
- 所有已实现的接口:
MetadataReaderFactory
Caching implementation of the
MetadataReaderFactory interface,
caching a MetadataReader instance per Resource handle
(i.e. per ".class" file).- 从以下版本开始:
- 4.0
- 作者:
- Juergen Hoeller, Costin Leau
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明static final intDefault maximum number of entries for a local MetadataReader cache: 256.private Map<Resource,MetadataReader> MetadataReader cache: either local or shared at the ResourceLoader level. -
构造器概要
构造器构造器说明Create a new CachingMetadataReaderFactory for the default class loader, using a local resource cache.CachingMetadataReaderFactory(ResourceLoader resourceLoader) Create a new CachingMetadataReaderFactory for the givenResourceLoader, using a shared resource cache if supported or a local resource cache otherwise.CachingMetadataReaderFactory(ClassLoader classLoader) Create a new CachingMetadataReaderFactory for the givenClassLoader, using a local resource cache. -
方法概要
修饰符和类型方法说明voidClear the local MetadataReader cache, if any, removing all cached class metadata.intReturn the maximum number of entries for the MetadataReader cache.getMetadataReader(Resource resource) Obtain a MetadataReader for the given resource.voidsetCacheLimit(int cacheLimit) Specify the maximum number of entries for the MetadataReader cache.从类继承的方法 cn.taketoday.core.type.classreading.SimpleMetadataReaderFactory
getMetadataReader, getResourceLoader
-
字段详细资料
-
DEFAULT_CACHE_LIMIT
public static final int DEFAULT_CACHE_LIMITDefault maximum number of entries for a local MetadataReader cache: 256.- 另请参阅:
-
metadataReaderCache
MetadataReader cache: either local or shared at the ResourceLoader level.
-
-
构造器详细资料
-
CachingMetadataReaderFactory
public CachingMetadataReaderFactory()Create a new CachingMetadataReaderFactory for the default class loader, using a local resource cache. -
CachingMetadataReaderFactory
Create a new CachingMetadataReaderFactory for the givenClassLoader, using a local resource cache.- 参数:
classLoader- the ClassLoader to use
-
CachingMetadataReaderFactory
Create a new CachingMetadataReaderFactory for the givenResourceLoader, using a shared resource cache if supported or a local resource cache otherwise.- 参数:
resourceLoader- the ResourceLoader to use (also determines the ClassLoader to use)- 另请参阅:
-
-
方法详细资料
-
setCacheLimit
public void setCacheLimit(int cacheLimit) Specify the maximum number of entries for the MetadataReader cache.Default is 256 for a local cache, whereas a shared cache is typically unbounded. This method enforces a local resource cache, even if the
ResourceLoadersupports a shared resource cache. -
getCacheLimit
public int getCacheLimit()Return the maximum number of entries for the MetadataReader cache. -
getMetadataReader
从接口复制的说明:MetadataReaderFactoryObtain a MetadataReader for the given resource.- 指定者:
getMetadataReader在接口中MetadataReaderFactory- 覆盖:
getMetadataReader在类中SimpleMetadataReaderFactory- 参数:
resource- the resource (pointing to a ".class" file)- 返回:
- a holder for the ClassReader instance (never
null) - 抛出:
IOException- in case of I/O failure
-
clearCache
public void clearCache()Clear the local MetadataReader cache, if any, removing all cached class metadata.
-