`
guanhuaing
  • 浏览: 1197835 次
文章分类
社区版块
存档分类
最新评论

alfresco中的ehcache介绍

阅读更多

一、alfresco中的ehcache介绍

为了提高系统性能,alfresco采用了许多不同的方法,使用cache就是其中之一。alfresco使用了ehcache作为其缓存。最新使用的ehcache的版本为 ehcache-core-2.0.0.jar

在alfresco中有两类ehcache:一个是用于事务的beanName为transactionalEHCacheManager,类名为org.alfresco.repo.cache.EhCacheManagerFactoryBean,不能覆盖或者集群使用;

另一个是用于共享的缓存beanName为internalEHCacheManager,类名为org.alfresco.repo.cache.InternalEhCacheManagerFactoryBean,这个缓存作为hibernate二级缓存用,在hibernate.cfg.xml中可以看到org.alfresco.repo.cache.InternalEhCacheManagerFactoryBean作为jdbc connection中hibernate.cache.provider_class属性的值。

transactionalEHCacheManager提供getObject()方法获得net.sf.ehcache.CacheManager的实例,返回的类型是Object;
internalEHCacheManager提供getObject()方法和getInstance()获得net.sf.ehcache.CacheManager的实例,区别是getObject()方法返回类型是Object,getInstance()返回类型是net.sf.ehcache.CacheManager;同时提供的buildCache()方法返回的是经过org.hibernate.cache.EhCache.EhCache(Cache cache)封装后的对象,即作为hibernate的二级缓存用。

transactionalEHCacheManager的配置文件是alfresco/ehcache-transactional.xml,在cache-context.xml中描述。
internalEHCacheManager的配置文件是alfresco/extension/ehcache-custom.xml和alfresco/ehcache-default.xml,先加载custom.xml,如果没有这个文件,再尝试加载default.xml文件。配置文件在类中设定。


二、两者的关系

所有的共享类型的缓存 Shared Cache都在cache-context.xml中被注入到事务类型的缓存中。

所有的事务类型的缓存都在ehcache-default.xml中有同名的cache的定义,以及在hibernate-context.xml 中被赋值给需要缓存的内容Dao的实现,比如qnameEntityCache赋值给qnameDAO。

三、alfresco中cache的内容
下面是alfreso中的cache缓存的内容,每种类型都包括两个缓存:即事务缓存和共享缓存。
ID lookup for QName entities
ID lookup for Namespace entities
ID lookup for Locale entities
Store and Node ID cache lookup
Parent Associations lookup for nodes
Authority container look up for users
Permissions access cache
Node owner cache
Person username to NodeRef cache
Authentication Ticket Cache
SysAdmin (JMX Config) Cache
AVM Lookup Cache
AVM Store lookup cache
WebServices Query Session Cache
ACL cache
Messages Caches
–LoadedResourceBundles
–ResourceBundleBaseNames
Dictionary / Namespace Caches
–UriToModels
–CompiledModels
Namespace Uris
–urisCache
–prefixesCache
Web Scripts Caches

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics