On 2/20/2014 7:01 PM, Neil wrote:
Honza Bambas wrote:

On 2/19/2014 11:25 PM, Neil wrote:

In particular, the API calls I'm interested in:

  1. Given an HTTP or FTP URI, return the size of the cached data

How do you do that now? Only way known to me (with the old cache is visit of a cache device). We don't have devices now, we have purpose-distinct storages. Those can be visited too. But only fully asynchronously.

cacheSession </comm-central/ident?i=httpCacheSession>.asyncOpenCacheEntry </comm-central/ident?i=asyncOpenCacheEntry>(URL </comm-central/ident?i=imgURL>, nsICache </comm-central/ident?i=nsICache>.ACCESS_READ </comm-central/ident?i=ACCESS_READ>, cacheListener </comm-central/ident?i=cacheListener>);

Today (cache2):

storage = nsICacheService.diskCacheStorage(loadcontextinfo)
storage.asyncOpenURI(uri, OPEN_READONLY, callback)
callback::OnCacheEntryAvaiable()

So, pretty similar. But the index can give you this info synchronously, w/o it. Still, the api is currently not exposed to XPCOM.



  2. Returning the size of the disk cache

You can asynchtonously visit a storage as mentioned above or this will be available via index.

The old way is to visit devices and then the device info includes the size.

Cache2 does the same way.

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to