зеркало из https://github.com/mozilla/pjs.git
Bug 647391 - Increase maximum size for objects stored in disk cache.
This commit is contained in:
Родитель
4ab625e2fe
Коммит
6496415458
|
@ -64,16 +64,16 @@ pref("browser.cache.disk.enable", true);
|
|||
pref("browser.cache.disk.smart_size.first_run", true);
|
||||
// Does the user want smart-sizing?
|
||||
pref("browser.cache.disk.smart_size.enabled", true);
|
||||
// Size explicitly set by the user. Used when smart_size.enabled == false
|
||||
// Size (in KB) explicitly set by the user. Used when smart_size.enabled == false
|
||||
pref("browser.cache.disk.capacity", 256000);
|
||||
// User-controllable max-size for entries in disk-cache. Regardless of this
|
||||
// setting, no entries bigger than 1/8 of disk-cache will be cached
|
||||
pref("browser.cache.disk.max_entry_size", 5120);
|
||||
// Max-size (in KB) for entries in disk cache. Set to -1 for no limit.
|
||||
// (Note: entries bigger than 1/8 of disk-cache are never cached)
|
||||
pref("browser.cache.disk.max_entry_size", 51200); // 50 MB
|
||||
pref("browser.cache.memory.enable", true);
|
||||
// -1 = determine dynamically, 0 = none, n = memory capacity in kilobytes
|
||||
//pref("browser.cache.memory.capacity", -1);
|
||||
// User-controllable max-size for entries in mem-cache. Regardless of this
|
||||
// setting, no entries bigger than 90% of the mem-cache will be cached
|
||||
// Max-size (in KB) for entries in memory cache. Set to -1 for no limit.
|
||||
// (Note: entries bigger than than 90% of the mem-cache are never cached)
|
||||
pref("browser.cache.memory.max_entry_size", 5120);
|
||||
pref("browser.cache.disk_cache_ssl", true);
|
||||
// 0 = once-per-session, 1 = each-time, 2 = never, 3 = when-appropriate/automatically
|
||||
|
|
|
@ -163,9 +163,11 @@ public:
|
|||
static void SetDiskCacheEnabled(PRBool enabled);
|
||||
// Sets the disk cache capacity (in kilobytes)
|
||||
static void SetDiskCacheCapacity(PRInt32 capacity);
|
||||
// Set max size for a disk-cache entry (in bytes). -1 disables this limit
|
||||
// Set max size for a disk-cache entry (in KB). -1 disables limit up to
|
||||
// 1/8th of disk cache size
|
||||
static void SetDiskCacheMaxEntrySize(PRInt32 maxSize);
|
||||
// Set max size for a memory-cache entry (in bytes). -1 disables this limit
|
||||
// Set max size for a memory-cache entry (in kilobytes). -1 disables
|
||||
// limit up to 90% of memory cache size
|
||||
static void SetMemoryCacheMaxEntrySize(PRInt32 maxSize);
|
||||
|
||||
static void SetOfflineCacheEnabled(PRBool enabled);
|
||||
|
|
|
@ -11,6 +11,15 @@ function get_cache_service() {
|
|||
getService(Ci.nsICacheService);
|
||||
}
|
||||
|
||||
var _PSvc;
|
||||
function get_pref_service() {
|
||||
if (_PSvc)
|
||||
return _PSvc;
|
||||
|
||||
return _PSvc = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
}
|
||||
|
||||
function get_ostream_for_entry(key, asFile, append, entryRef)
|
||||
{
|
||||
var cache = get_cache_service();
|
||||
|
@ -79,9 +88,13 @@ function write_datafile()
|
|||
var oStr = get_ostream_for_entry("data", true, false, entry);
|
||||
var data = gen_1MiB();
|
||||
|
||||
// 6MiB
|
||||
// max size in MB
|
||||
var max_size = get_pref_service().
|
||||
getIntPref("browser.cache.disk.max_entry_size") / 1024;
|
||||
|
||||
// write larger entry than is allowed
|
||||
var i;
|
||||
for (i=0 ; i<6 ; i++)
|
||||
for (i=0 ; i<(max_size+1) ; i++)
|
||||
write_and_check(oStr, data, data.length);
|
||||
|
||||
oStr.close();
|
||||
|
|
Загрузка…
Ссылка в новой задаче