Closed
Bug 20893
Opened 26 years ago
Closed 26 years ago
Cache preferences need to be hooked up
Categories
(Core :: Networking: Cache, defect, P3)
Core
Networking: Cache
Tracking
()
VERIFIED
FIXED
M14
People
(Reporter: fur, Assigned: davidm)
References
Details
(Whiteboard: [PDT+])
Reporter | ||
Updated•26 years ago
|
Mass move of all bugs without target milestones to M13.
Reporter | ||
Comment 1•26 years ago
|
||
The prefs that assign the disk and memory cache size need to be hooked up to the
cache manager. Here's a little sample code:
nsresult
SetCachePrefs(PRUint32 aMemCacheCapacity,
PRUint32 aDiskCacheCapacity,
nsIFileSpec aDiskCacheFolder)
{
NS_WITH_SERVICE(nsINetDataCacheManager, cacheManager,
NS_NETWORK_CACHE_MANAGER_PROGID, &rv);
if (NS_FAILED(rv)) return rv;
cacheManager->SetMemCacheCapacity(aMemCacheCapacity);
cacheManager->SetDiskCacheCapacity(aDiskCacheCapacity);
cacheManager->SetDiskCacheFolder(aDiskCacheFolder);
return NS_OK;
}
NOTES:
The memory allotted for the "Memory Cache" pref is actually divided between the
image cache and the network data cache. You might want to look at 4.x to see
the formula that was used for this purpose.
It would be nice if cache prefs didn't get set until cache manager is loaded.
The current design does not allow for this, since there's no way to know when
the cache manager is being loaded and the cache itself does not interrogate the
prefs module. This is a place where the cache manager might need to be
modified.
Clearing a cache can be implemented by temporarily setting its capacity to zero
and then restoring it. However, doing so removes only the cache content, not
the cache metadata, e.g. i.e. the URLs and http headers, visit times, and so
forth remain in the database. So, one should probably instead call the
RemoveAll() method on each individual cache. Better yet, get rid of the "Clear
Memory Cache" button and just add a single "Clear Cache" button that clears both
the memory cache and the disk cache. When the button is pressed, call the cache
manager's RemoveAll() method, which will clear out both the memory and the disk
caches.
Bulk move of all Cache (to be deleted component) bugs to new Networking: Cache
component.
Comment 3•26 years ago
|
||
Assigning fur's cache bugs to Gordon. He can split them up with davidm.
Comment 4•26 years ago
|
||
spam: added self to cc list as this might affect my realm.
Updated•26 years ago
|
Target Milestone: M13 → M14
reassign as I am messing around with these right now
Assignee: gordon → davidm
Status: ASSIGNED → NEW
fix checked in
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Comment hidden (collapsed) |
You need to log in
before you can comment on or make changes to this bug.
Description
•