Closed Bug 20893 Opened 25 years ago Closed 25 years ago

Cache preferences need to be hooked up

Categories

(Core :: Networking: Cache, defect, P3)

defect

Tracking

()

VERIFIED FIXED

People

(Reporter: fur, Assigned: davidm)

References

Details

(Whiteboard: [PDT+])

Blocks: 14050
Depends on: 8305
Mass move of all bugs without target milestones to M13.
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.
Assigning fur's cache bugs to Gordon. He can split them up with davidm.
spam: added self to cc list as this might affect my realm.
Target Milestone: M13 → M14
Status: NEW → ASSIGNED
reassign as I am messing around with these right now
Assignee: gordon → davidm
Status: ASSIGNED → NEW
Keywords: beta1
PDT+
Whiteboard: [PDT+]
fix checked in
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Verified fixed.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.