Class CachingContentStore
- java.lang.Object
-
- org.alfresco.repo.content.caching.CachingContentStore
-
- All Implemented Interfaces:
org.alfresco.repo.content.ContentStore,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.context.ApplicationEventPublisherAware
public class CachingContentStore extends java.lang.Object implements org.alfresco.repo.content.ContentStore, org.springframework.context.ApplicationEventPublisherAware, org.springframework.beans.factory.BeanNameAwareImplementation of ContentStore that wraps any other ContentStore (the backing store) transparently providing caching of content in that backing store.CachingContentStore should only be used to wrap content stores that are significantly slower that FileContentStore - otherwise performance may actually degrade from its use.
It is important that cacheOnInbound is set to true for exceptionally slow backing stores.
This store handles the
FileContentStore.SPOOF_PROTOCOLand can be used to wrap stores that do not handle the protocol out of the box e.g. the S3 connector's store.- Author:
- Matt Ward
-
-
Constructor Summary
Constructors Constructor Description CachingContentStore()CachingContentStore(org.alfresco.repo.content.ContentStore backingStore, ContentCache cache, boolean cacheOnInbound)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete(java.lang.String contentUrl)booleanexists(java.lang.String contentUrl)java.lang.StringgetBackingStoreDescription()java.lang.StringgetBackingStoreType()java.lang.StringgetBeanName()ContentCachegetCache()intgetMaxCacheTries()QuotaManagerStrategygetQuota()org.alfresco.service.cmr.repository.ContentReadergetReader(java.lang.String contentUrl)java.lang.StringgetRootLocation()longgetSpaceFree()longgetSpaceTotal()org.alfresco.service.cmr.repository.ContentWritergetWriter(org.alfresco.repo.content.ContentContext context)voidinit()Initialisation method, should be called once the CachingContentStore has been constructed.booleanisCacheOnInbound()booleanisContentUrlSupported(java.lang.String contentUrl)booleanisWriteSupported()java.util.concurrent.locks.ReentrantReadWriteLockreadWriteLock(java.lang.String url)Get a ReentrantReadWriteLock for a given URL.voidsetApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)voidsetBackingStore(org.alfresco.repo.content.ContentStore backingStore)voidsetBeanName(java.lang.String name)voidsetCache(ContentCache cache)voidsetCacheOnInbound(boolean cacheOnInbound)voidsetMaxCacheTries(int maxCacheTries)voidsetQuota(QuotaManagerStrategy quota)Sets the QuotaManagerStrategy that will be used.
-
-
-
Constructor Detail
-
CachingContentStore
public CachingContentStore()
-
CachingContentStore
public CachingContentStore(org.alfresco.repo.content.ContentStore backingStore, ContentCache cache, boolean cacheOnInbound)
-
-
Method Detail
-
init
public void init()
Initialisation method, should be called once the CachingContentStore has been constructed.
-
isContentUrlSupported
public boolean isContentUrlSupported(java.lang.String contentUrl)
- Specified by:
isContentUrlSupportedin interfaceorg.alfresco.repo.content.ContentStore
-
isWriteSupported
public boolean isWriteSupported()
- Specified by:
isWriteSupportedin interfaceorg.alfresco.repo.content.ContentStore
-
getSpaceFree
public long getSpaceFree()
- Specified by:
getSpaceFreein interfaceorg.alfresco.repo.content.ContentStore
-
getSpaceTotal
public long getSpaceTotal()
- Specified by:
getSpaceTotalin interfaceorg.alfresco.repo.content.ContentStore
-
getRootLocation
public java.lang.String getRootLocation()
- Specified by:
getRootLocationin interfaceorg.alfresco.repo.content.ContentStore
-
exists
public boolean exists(java.lang.String contentUrl)
For
spoofedURLs, the URL always exists.- Specified by:
existsin interfaceorg.alfresco.repo.content.ContentStore
-
getReader
public org.alfresco.service.cmr.repository.ContentReader getReader(java.lang.String contentUrl)
This store handles the
FileContentStore.SPOOF_PROTOCOLso that underlying stores do not need to implement anything related to spoofing.- Specified by:
getReaderin interfaceorg.alfresco.repo.content.ContentStore
-
getWriter
public org.alfresco.service.cmr.repository.ContentWriter getWriter(org.alfresco.repo.content.ContentContext context)
- Specified by:
getWriterin interfaceorg.alfresco.repo.content.ContentStore
-
delete
public boolean delete(java.lang.String contentUrl)
- Specified by:
deletein interfaceorg.alfresco.repo.content.ContentStore
-
readWriteLock
public java.util.concurrent.locks.ReentrantReadWriteLock readWriteLock(java.lang.String url)
Get a ReentrantReadWriteLock for a given URL. The lock is from a pool rather than per URL, so some contention is expected.- Parameters:
url- String- Returns:
- ReentrantReadWriteLock
-
setBackingStore
public void setBackingStore(org.alfresco.repo.content.ContentStore backingStore)
-
getBackingStoreType
public java.lang.String getBackingStoreType()
-
getBackingStoreDescription
public java.lang.String getBackingStoreDescription()
-
setCache
public void setCache(ContentCache cache)
-
getCache
public ContentCache getCache()
-
setCacheOnInbound
public void setCacheOnInbound(boolean cacheOnInbound)
-
isCacheOnInbound
public boolean isCacheOnInbound()
-
getMaxCacheTries
public int getMaxCacheTries()
-
setMaxCacheTries
public void setMaxCacheTries(int maxCacheTries)
-
setQuota
public void setQuota(QuotaManagerStrategy quota)
Sets the QuotaManagerStrategy that will be used.- Parameters:
quota- QuotaManagerStrategy
-
getQuota
public QuotaManagerStrategy getQuota()
-
setApplicationEventPublisher
public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
- Specified by:
setApplicationEventPublisherin interfaceorg.springframework.context.ApplicationEventPublisherAware
-
setBeanName
public void setBeanName(java.lang.String name)
- Specified by:
setBeanNamein interfaceorg.springframework.beans.factory.BeanNameAware
-
getBeanName
public java.lang.String getBeanName()
-
-