On Mon, 2005-05-30 at 15:33 -0500, Reshat Sabiq wrote: > email message attachment, "Forwarded message - Re: caching and XPCOM" > On Mon, 2005-05-30 at 15:33 -0500, Reshat Sabiq wrote: > > On Sun, 2005-05-22 at 21:11 +0200, Christian Biesinger wrote: > > > mozilla-netlib would be a better place for this, fwiw > > > > > > Reshat Sabiq wrote: > > > > I played w/ it a little more, and found the following: > > > > The Cache folder above indeed stores temporary files, however, there are > > > > 2 unknowns for me at this time: > > > > 1. How would i be able to identify which file an object is in, knowing > > > > the object's URL, and possibly other characteristics (size, etc.)? There > > > > appears to be something like md5sum involved, on the basis of several > > > > object characteristics. > > > > > > So, not all entities are stored as separate files. If they are small > > > enough, they are stored in the _CACHE_00x_ files. Only if they are > > > larger they are stored as a separate file. > > > > > > Use nsICacheService > > > (http://lxr.mozilla.org/seamonkey/source/netwerk/cache/public/nsICacheService.idl) > > > > > > and related interfaces. > > > > > > > > I am able to get the instances of interfaces needed, but i'm getting > > NS_ERROR_CACHE_KEY_NOT_FOUND for every image URL i pass to: > > result = cacheSession->OpenCacheEntry(url, nsICache::ACCESS_READ, > > PR_TRUE, getter_AddRefs(cacheEntry)); > > > > I have 2 question about this, and would appreciate any feedback: > > 1. Why even when the image is in profile's cache as a separate file, i > > still get this error? E.g., for char *url = > > "http://us.news3.yimg.com/us.i2.yimg.com/p/rids/20050505/i/r1951409762.jpg?x=380&y=266&sig=Xj2W4LLjWxHTAWQ0QY9evA--" > > which in my cache is stored as 3AAC0BF8d01. If the key is not URL, what > > is it? > > 2. This may be resolved by 1, by do i understand correctly that if item > > is not in the Cache folder, then it will have an ICache in memory? The > > small images are not in the hard-drive at all. I guess when i know the > > key magic from question 1, i will be able to see if i get an ICache for > > these as well. > > > > Thanks. > > I figured it out: i was using he wrong client ID. I didn't realize it mattered. Interesting, but for the image above, even though that key is also in the cache it returns nothing unless the HTTP params are stripped to make it: http://us.news1.yimg.com/us.yimg.com/p/rids/20050505/i/r1951409762.jpg
So both of the questions above have been answered. But i now have another one: How could i save an image cache as a disk file? Thanks.
signature.asc
Description: This is a digitally signed message part