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:
@@ -182,7 +182,8 @@ cache.<name>.diskLimit::
|
|||||||
+
|
+
|
||||||
Maximum number of cache items to retain on disk, if this cache
|
Maximum number of cache items to retain on disk, if this cache
|
||||||
supports storing its items to disk. Like memoryLimit, this is
|
supports storing its items to disk. Like memoryLimit, this is
|
||||||
total number of items, not bytes of disk used.
|
total number of items, not bytes of disk used. If 0, disk storage
|
||||||
|
for this cache is disabled.
|
||||||
+
|
+
|
||||||
Default is 16384.
|
Default is 16384.
|
||||||
|
|
||||||
|
|||||||
@@ -159,8 +159,8 @@ public class CacheManagerProvider implements Provider<CacheManager> {
|
|||||||
int buffer = c.getDiskSpoolBufferSizeMB() * MB;
|
int buffer = c.getDiskSpoolBufferSizeMB() * MB;
|
||||||
buffer = config.getInt("cache", name, "diskbuffer", buffer) / MB;
|
buffer = config.getInt("cache", name, "diskbuffer", buffer) / MB;
|
||||||
c.setDiskSpoolBufferSizeMB(Math.max(1, buffer));
|
c.setDiskSpoolBufferSizeMB(Math.max(1, buffer));
|
||||||
c.setOverflowToDisk(true);
|
c.setOverflowToDisk(c.getMaxElementsOnDisk() > 0);
|
||||||
c.setDiskPersistent(true);
|
c.setDiskPersistent(c.getMaxElementsOnDisk() > 0);
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user