I am writing an application (C program) in which I would like to do a
text search (similar to 'grep') on text documents in the disk cache.
While I can easily search the files in the cache diretory, I need to
find their original URLs. Once I can match the key (URL) to the file
on disk, I'll be all set. I was hoping to be able to look at the cache
source code and determine how to read the cache entries, but have
found this a daunting task.
>From netwerk/protocol/about/src/nsAboutCacheEntry.cpp it looks like I
need to do something like this:
388 rv = descriptor->GetKey(getter_Copies(str));
and then
474 rv = descriptor->GetFile(getter_AddRefs(cacheFile));
475 if (NS_SUCCEEDED(rv)) {
476 nsAutoString filePath;
477 cacheFile->GetPath(filePath);
478 APPEND_ROW("file on disk",
NS_ConvertUCS2toUTF8(filePath));
479 }
However, even after scouring the header files, I can't figure out how
nsICacheEntryDescriptor structure is formatted. Once I know this, can
I simply read the cache entry files (_CACHE_001_ etc.) and parse the
information I need?
Thanks much for the assistance!
Josiah Dykstra