ALF-9613: caching content store. Various improvements and bug fixes. Including:

ALF-10097: disk-persistent cache settings in ehcache
ALF-10098: clean up  process should remove empty parent directories from content cache disk directory
ALF-10126: timeToIdle ehcache property was not affecting cache cleaner job
ALF-10127: externally deleted cached content files were not re-cached until after the items expired from ehcache

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@30171 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Matt Ward
2011-09-02 09:03:49 +00:00
parent 1b2e8c53ec
commit ac8b3ce1fc
11 changed files with 409 additions and 71 deletions

View File

@@ -23,6 +23,7 @@ import java.io.File;
import org.alfresco.repo.content.caching.CacheFileProps;
import org.alfresco.repo.content.caching.ContentCacheImpl;
import org.alfresco.repo.content.caching.FileHandler;
import org.alfresco.util.Deleter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Required;
@@ -130,8 +131,11 @@ public class CachedContentCleaner implements FileHandler
CacheFileProps props = new CacheFileProps(cacheFile);
props.delete();
cacheFile.delete();
Deleter.deleteEmptyParents(cacheFile, cache.getCacheRoot());
}
@Required
public void setCache(ContentCacheImpl cache)
{

View File

@@ -24,6 +24,7 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import org.alfresco.repo.content.caching.CacheFileProps;
@@ -93,6 +94,21 @@ public class CachedContentCleanupJobTest
}
}
@Test
public void emptyParentDirectoriesAreDeleted() throws FileNotFoundException
{
cleaner.setMaxDeleteWatchCount(0);
File file = new File(cacheRoot, "243235984/a/b/c/d.bin");
file.getParentFile().mkdirs();
PrintWriter writer = new PrintWriter(file);
writer.println("Content for emptyParentDirectoriesAreDeleted");
writer.close();
assertTrue("Directory should exist", new File(cacheRoot, "243235984/a/b/c").exists());
cleaner.handle(file);
assertFalse("Directory should have been deleted", new File(cacheRoot, "243235984").exists());
}
@Test
public void markedFilesHaveDeletionDeferredUntilCorrectPassOfCleaner()