The nsICacheSession interface handles open synchronous and asynchronous cache entry operations along with evicting cache entries and checking for cache devices instantiation according to the session storage policies.
nsICacheSession is defined in netwerk/cache/public/nsICacheSession.idl
. It is scriptable
and
unfrozen (hasn't changed since Mozilla 1.9)
.
Inherits from: nsISupports
nsICacheEntryDescriptor openCacheEntry(in ACString key, in nsCacheAccessMode accessRequested, in boolean blockingMode);
|
void asyncOpenCacheEntry(in ACString key, in nsCacheAccessMode accessRequested, in nsICacheListener listener);
|
void evictEntries();
|
PRBool isStorageEnabled();
|
| Attribute | Type | Description |
doomEntriesIfExpired
| PRBool
| Expired entries will be doomed or evicted if this attribute is set to true. If false, expired entries will be returned (useful for offline- mode and clients, such as HTTP, that can update the valid lifetime of cached content). This attribute defaults to true.
|
This method gives a synchronous cache access. It returns a unique descriptor each time it is called, even if the same key is specified. When called by multiple threads for WRITE access, only one writable descriptor will be granted. If blockingMode is set to false, it will return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another descriptor has been given WRITE access but hasn't validated the entry yet.
A cache session can only give out one descriptor with WRITE access to a given cache entry at a time. Until the client calls MarkValid on its descriptor, other attempts to open the same cache entry will block.
nsICacheEntryDescriptor openCacheEntry( in ACString key, in nsCacheAccessMode accessRequested, in boolean blockingMode );
This method gives an asynchronous cache access. Does not block the calling thread. Instead, the listener will be notified when the descriptor is available.
void asyncOpenCacheEntry( in ACString key, in nsCacheAccessMode accessRequested, in nsICacheListener listener );
This method evicts all entries for this session's clientID according to its storagePolicy.
void evictEntries();
Page last modified 02:27, 1 Dec 2007 by Arehman4