mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
125603 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125484 slanglois: MNT-16155 Update source headers - remove old Copyrights from Java and JSP dource files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@125781 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
62 lines
1.7 KiB
Java
62 lines
1.7 KiB
Java
package org.alfresco.repo.cache;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Properties;
|
|
|
|
import org.apache.commons.logging.Log;
|
|
import org.apache.commons.logging.LogFactory;
|
|
import org.hibernate.cache.Cache;
|
|
import org.hibernate.cache.CacheException;
|
|
import org.hibernate.cache.CacheProvider;
|
|
import org.hibernate.cache.Timestamper;
|
|
|
|
/**
|
|
* A simple {@link CacheProvider} that allows Hibernate to create {@link DefaultSimpleCache}
|
|
* based caches.
|
|
*
|
|
* @author Matt Ward
|
|
*/
|
|
public class DefaultCacheProvider implements CacheProvider
|
|
{
|
|
private final static Log log = LogFactory.getLog(DefaultCacheProvider.class);
|
|
// TODO: setup in spring (SystemPropertiesSetterBean)
|
|
private int defaultMaxItems = 500;
|
|
|
|
@Override
|
|
public Cache buildCache(String regionName, Properties properties) throws CacheException
|
|
{
|
|
if (log.isDebugEnabled())
|
|
{
|
|
log.debug("building cache for regionName=" + regionName + ", with properties: " + properties);
|
|
}
|
|
DefaultSimpleCache<Serializable, Object> cache = new DefaultSimpleCache<Serializable, Object>(defaultMaxItems, null);
|
|
Cache hibCache = new HibernateSimpleCacheAdapter(cache, regionName);
|
|
return hibCache;
|
|
}
|
|
|
|
@Override
|
|
public long nextTimestamp()
|
|
{
|
|
return Timestamper.next();
|
|
}
|
|
|
|
@Override
|
|
public void start(Properties properties) throws CacheException
|
|
{
|
|
log.debug("Starting cache provider");
|
|
}
|
|
|
|
@Override
|
|
public void stop()
|
|
{
|
|
log.debug("Stopping cache provider");
|
|
}
|
|
|
|
@Override
|
|
public boolean isMinimalPutsEnabledByDefault()
|
|
{
|
|
return false;
|
|
}
|
|
|
|
}
|