netwerk/cache/public/nsICacheService.idlScriptable
Handles visiting and evicting entries operations along with the creating of cache sessions and creation of temporary client IDs operations for offline caching.
66
Introduced
Gecko 1.0
Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)

This interface is no longer supported and planned to be removed soon: use nsICacheStorageService instead. At the time of writing there is no documentation for nsICacheStorageService but comments are available in the source.

Note: Starting in Gecko 2.0, cache I/O is handled asynchronously.

Method overview

nsICacheSession createSession(in string clientID, in nsCacheStoragePolicy storagePolicy, in boolean streamBased);
ACString createTemporaryClientID(in nsCacheStoragePolicy storagePolicy); Obsolete since Gecko 1.9.2
void evictEntries(in nsCacheStoragePolicy storagePolicy);
void init(); Obsolete since Gecko 1.8
void shutdown(); Obsolete since Gecko 1.8
void visitEntries(in nsICacheVisitor visitor);

Attributes

Attribute Type Description
cacheIOTarget nsIEventTarget The event target for cache I/O operation notifications. Read only.

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.

createTemporaryClientID()

Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.

Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

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().

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

Returns a newly created unique, temporary cache client ID.

Exceptions thrown
NS_ERROR_NOT_IMPLEMENTED
This method is deprecated.

evictEntries()

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

Note: This function may evict some items but will throw if it fails to evict everything.

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

init()

Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Initialize the cache service.

void init();
Parameters

None.

Exceptions thrown
Missing Exception
Missing Description

shutdown()

Obsolete since Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Shutdown() the cache service.

void shutdown();
Parameters

None.

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.

See also