Open Bug 1209560 Opened 6 years ago Updated 2 years ago

Cache API should prune empty directories when closing

Categories

(Core :: Storage: Cache API, task)

task
Not set
normal

Tracking

()

People

(Reporter: bkelly, Unassigned)

Details

Looking at my current Cache profile dir for trained-to-thrill, I see that there are a large number of empty directories in the morgue.  This is because trained-to-thrill removes old Responses when it updates with new flikr images.  When a Response is removed, we currently just leave the intermediate morgue directory even if its now empty.

This is not a real problem, but it does use a small amount of disk space and pessimizes the disk lookup since there are more directory entries to traverse.

We should consider removing empty directories when the Cache is closed for an origin.  The easiest place do this would be during the database connection close where we currently run the incremental vacuum:

  https://dxr.mozilla.org/mozilla-central/source/dom/cache/Connection.cpp?from=dom%2Fcache%2FConnection.cpp&offset=0#44

Its not really a database operation, but its the best "on close" hook we have at the moment.
Component: DOM → DOM: Core & HTML
Component: DOM: Core & HTML → Storage: Cache API
No longer blocks: 1110136
Type: defect → task
You need to log in before you can comment on or make changes to this bug.