Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

nsICacheService

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

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.

Requires Gecko 1.9 (Firefox 3)

createTemporaryClientID()

Deprecated
This feature has been removed from the Web. Though some browsers may still support it, it is in the process of being dropped. Do not use it in old or new projects. Pages or Web apps using it may break 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.

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

init()

Initialize the cache service.

void init();
Parameters

None.

Exceptions thrown
Missing Exception
Missing Description

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

shutdown()

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

Document Tags and Contributors

 Contributors to this page: Sheppy, kscarfone, trevorh, Varmaa, Arehman4
 Last updated by: Sheppy,