Mozilla.com

  1. MDC
  2. Main Page
  3. nsICacheService

nsICacheService

The nsICacheService interface handles visiting and evicting entries operations along with the creating cache sessions and creating temporary client ID's operations for offline caching.


nsICacheService is defined in netwerk/cache/public/nsICacheService.idl . It is scriptable and unfrozen (hasn't changed since Mozilla 1.9) .

Inherits from: nsISupports

Method overview

nsICacheSession createSession(in string clientID, in nsCacheStoragePolicy storagePolicy, in boolean streamBased);
void visitEntries(in nsICacheVisitor visitor);
void evictEntries(in nsCacheStoragePolicy storagePolicy);
ACString createTemporaryClientID(in nsCacheStoragePolicy storagePolicy);

Methods

createSession()

This method creates a cache session.

A cache session represents a client's access into the cache. The cache session is not "owned" by the cache service. Hence, it is possible to create duplicate cache sessions. Entries created by a cache session are invisible to other cache sessions, unless the cache sessions are equivalent.

 nsICacheSession createSession(
   in string clientID,
   in nsCacheStoragePolicy storagePolicy,
   in boolean streamBased
 );
Parameters
clientID
Specifies the name of the client using the cache.
storagePolicy
Limits the storage policy for all entries accessed via the returned session. As a result, devices excluded by the storage policy will not be searched when opening entries from the returned session.
streamBased
Indicates whether or not the data being cached can be represented as a stream. The storagePolicy must be consistent with the value of this field. For example, a non-stream-based cache entry can only have a storage policy of STORE_IN_MEMORY.
Return value

Returns a new cache session.

visitEntries()

This method visits entries stored in the cache. Used to implement the about:cache URI.

 void visitEntries(
   in nsICacheVisitor visitor
 );
Parameters
visitor
The entry to be visited.

evictEntries()

This method evicts all entries in all devices implied by the storage policy.

 void evictEntries(
   in nsCacheStoragePolicy storagePolicy
 );
Parameters
storagePolicy
The cache storage policy.

createTemporaryClientID()

This method creates and returns a unique, temporary cache client ID.

This is used by the offline cache. The offline cache lets clients accumulate entries in a temporary client and merge them in as a group using nsIOfflineCacheSession mergeTemporaryClient() method.

 ACString createTemporaryClientID(
   in nsCacheStoragePolicy storagePolicy
 );
Parameters
storagePolicy
The cache storage policy.
Return value

Returns a newly created unique, temporary cache client ID.

Page last modified 16:31, 5 Aug 2008 by Varmaa

Files (0)