Closed Bug 964898 Opened 6 years ago Closed 6 years ago

HTTP cache v2: delete cache2 dir after the pref switch

Categories

(Core :: Networking: Cache, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: mayhemer, Assigned: mayhemer)

References

Details

Attachments

(1 file)

I think we can use an internal function of the new cache service to just delete the stuff some 1 minute after start up while the pref is at "use old cache".

Easy patch to build.
Attached patch v1Splinter Review
Jason, what do you think about the following way to do the deletion:
- there is a new pref "browser.cache.auto_delete_cache_version"
- at -1 it does nothing
- at 0 it deletes the old cache (Cache) when user is on the new cache, otherwise does nothing
- at 1 it deletes the cache2 dir when user is using the old cache, otherwise does nothing

This patch actually prepares land to also delete the old cache when we fully switch to cache2 once.  And the auto-deletion may be easily turned off for e.g. development purposes.
Assignee: nobody → honzab.moz
Status: NEW → ASSIGNED
Attachment #8367089 - Flags: feedback?(jduell.mcbugs)
Blocks: 967693
Comment on attachment 8367089 [details] [diff] [review]
v1

Review of attachment 8367089 [details] [diff] [review]:
-----------------------------------------------------------------

Looks ready to land with a couple nits fixed.  No need to re-review if you agree with them.

::: netwerk/cache/nsCacheService.h
@@ +126,5 @@
>      static int32_t   CacheCompressionLevel();
>  
>      static bool      GetClearingEntries();
>  
> +    static void      DiskCacheDirectory(nsIFile ** result);

"GetDiskCacheDirectory"?  I'm used to this kind of method having a "Get" prefix.  No big deal--your call.

::: netwerk/cache2/CacheFileIOManager.h
@@ +223,5 @@
>  
>    static nsresult EnumerateEntryFiles(EEnumerateMode aMode,
>                                        CacheEntriesEnumerator** aEnumerator);
>  
> +  static void CacheDirectory(nsIFile** result);

Also GetCacheDirectory?

::: netwerk/cache2/CacheObserver.cpp
@@ +122,5 @@
>      break;
>    }
>  }
>  
> +void CacheObserver::SchduleAutoDelete()

typo: "Schedule"
Attachment #8367089 - Flags: feedback?(jduell.mcbugs) → review+
https://hg.mozilla.org/mozilla-central/rev/955e0211df10
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Depends on: 1001361
You need to log in before you can comment on or make changes to this bug.