Class CachingMapPropertiesManagerImpl
- java.lang.Object
-
- org.onehippo.forge.properties.impl.AbstractPropertiesManager
-
- org.onehippo.forge.properties.impl.PropertiesManagerImpl
-
- org.onehippo.forge.properties.impl.CachingMapPropertiesManagerImpl
-
- All Implemented Interfaces:
PropertiesManager
public class CachingMapPropertiesManagerImpl extends PropertiesManagerImpl implements PropertiesManager
Faster alternative for CachingPropertiesManagerImpl, based on code donation by Ebrahim Aharpour. To use it, call interface method getProperties(HippoBean baseBean) which is overridden, or use public non-interface method getProperties(HippoBean baseBean, Locale locale) to get cached maps. See https://issues.onehippo.com/browse/HIPPLUG-671
-
-
Constructor Summary
Constructors Constructor Description CachingMapPropertiesManagerImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String
createCanonicalKey(org.hippoecm.hst.content.beans.standard.HippoBean location, String path)
Create a key for a location an a relative path of a properties document.protected Map<String,String>
getFromCache(String localeKey)
Get a properties bean from cache.Map<String,String>
getProperties(org.hippoecm.hst.content.beans.standard.HippoBean baseBean)
Returns a map with String name/value pairs.Map<String,String>
getProperties(org.hippoecm.hst.content.beans.standard.HippoBean baseBean, Locale locale)
getProperties method with a locale (not in PropertiesManager interface)protected Map<String,String>
getPropertiesMapByLocale(org.hippoecm.hst.content.beans.standard.HippoBean location, String path, Locale locale)
void
invalidate(String canonicalPath)
Invalidate a cached document based on the canonical path of a properties document, or invalidate all if the path is null.protected void
storeInCache(String canonicalKey, String localeKey, Map<String,String> propertiesBean)
Store a properties bean in cache.-
Methods inherited from class org.onehippo.forge.properties.impl.PropertiesManagerImpl
getDefaultDocumentLocation, getDefaultDocumentName, getDefaultLocation, getPropertiesBean, getPropertiesBean, getPropertiesBean, getPropertiesBeans, getTranslatedProperties, setDefaultDocumentLocation, setDefaultDocumentName
-
Methods inherited from class org.onehippo.forge.properties.impl.AbstractPropertiesManager
getProperties, getPropertiesBean, getPropertiesBean, getPropertiesBeans
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.onehippo.forge.properties.api.PropertiesManager
getDefaultDocumentLocation, getDefaultDocumentName, getProperties, getPropertiesBean, getPropertiesBean, getPropertiesBean, getPropertiesBean, getPropertiesBeans, getPropertiesBeans
-
-
-
-
Method Detail
-
invalidate
public void invalidate(String canonicalPath)
Description copied from class:PropertiesManagerImpl
Invalidate a cached document based on the canonical path of a properties document, or invalidate all if the path is null.- Specified by:
invalidate
in interfacePropertiesManager
- Overrides:
invalidate
in classPropertiesManagerImpl
- Parameters:
canonicalPath
- the path of a properties document, relative to the base bean, or null.
-
getProperties
public Map<String,String> getProperties(org.hippoecm.hst.content.beans.standard.HippoBean baseBean)
Description copied from class:AbstractPropertiesManager
Returns a map with String name/value pairs. Get the properties from the document with the default name at the default location.- Specified by:
getProperties
in interfacePropertiesManager
- Overrides:
getProperties
in classAbstractPropertiesManager
- Parameters:
baseBean
- the base bean from where to get the properties location, normally the siteContentBaseBean.
-
getProperties
public Map<String,String> getProperties(org.hippoecm.hst.content.beans.standard.HippoBean baseBean, Locale locale)
getProperties method with a locale (not in PropertiesManager interface)
-
createCanonicalKey
protected String createCanonicalKey(org.hippoecm.hst.content.beans.standard.HippoBean location, String path) throws javax.jcr.RepositoryException
Create a key for a location an a relative path of a properties document.- Throws:
javax.jcr.RepositoryException
-
getFromCache
protected Map<String,String> getFromCache(String localeKey)
Get a properties bean from cache.
-
storeInCache
protected void storeInCache(String canonicalKey, String localeKey, Map<String,String> propertiesBean)
Store a properties bean in cache. NB synchronized method: although the caches are synchronized themselves, adding values to cached lists is not.
-
-