Allow cache.<name>.diskLimit = 0 to disable on disk cache

Being able to make the on disk cache disabled for only some caches
is more useful than being able to make the on disk cache unlimited
in size.  Ehcache isn't that efficient at writing elements out to
the disk, and since this is strictly a cache, it should always have
a reasonable bound placed on its contents.

Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2009-08-17 07:05:03 -07:00
parent 73a79cab4f
commit a5e36d59ac
2 changed files with 4 additions and 3 deletions

View File

@@ -159,8 +159,8 @@ public class CacheManagerProvider implements Provider<CacheManager> {
int buffer = c.getDiskSpoolBufferSizeMB() * MB;
buffer = config.getInt("cache", name, "diskbuffer", buffer) / MB;
c.setDiskSpoolBufferSizeMB(Math.max(1, buffer));
c.setOverflowToDisk(true);
c.setDiskPersistent(true);
c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0);
c.setDiskPersistent(c.getMaxElementsOnDisk() > 0);
}
return c;
}