WARNING: Most of this content (with the exception of the Mozilla 1.9 XPCOM reference) is very old, and can be expected to be out of date and possibly obsolete. For better XUL documentation, please visit the XUL hub at the Mozilla Developer Center.

nsIOfflineCacheSession

IID:de7875e5-a7e2-4d8d-ad01-807ef55ef8c0
Inherits From:nsISupports

The offline cache is meant to reliably store resources for offline use. The expected semantics are:

A) Once populated, the cache will not evict an application resource unless explicitly asked.

B) Resources no longer in use by the application should be evicted.

C) If the cache fills up, new entries should be rejected rather than throwing out old ones.

The offline cache uses domains to concretely represent an application. It maintains a list of resources to be pinned for each domain. This list is separate from actual cache population - the caller is still responsible for placing items in the cache, and ownership can be declared without a corresponding entry.

A key can optionally be associated with a specific URI within the domain.


Methods

void addOwnedKey ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key ) void clearKeysOwnedByDomain ( ACString ownerAsciiDomain ) void evictUnownedEntries ( ) void getOwnedKeys ( ACString ownerAsciiDomain , ACString ownerAsciiKey , out PRUint32 count , out arrayof char* keys ) void getOwnerDomains ( out PRUint32 count , out arrayof char* domains ) void getOwnerURIs ( ACString ownerAsciiDomain , out PRUint32 count , out arrayof char* uris ) PRBool keyIsOwned ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key ) void mergeTemporaryClientID ( ACString temporaryClientID ) void removeOwnedKey ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key ) void setOwnedKeys ( ACString ownerAsciiDomain , ACString ownerAsciiKey , PRUint32 count , arrayof char* keys )

void addOwnedKey ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key )

Adds an owned key to a domain/URI pair.

A key can be added while there is no associated entry. When an entry is created with this key, it will be owned by the domain/URI pair.

Arguments:
ownerAsciiDomain: The domain that owns the resources !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
ownerAsciiKey: The specific key that owns the resources. You may use ascii encoded URI spec of the owner - nsIURI.asciiSpec. This can be empty if none specifically owns the resources.
key: The key to add.

void clearKeysOwnedByDomain ( ACString ownerAsciiDomain )

Remove all keys owned by a domain, including keys owned by a specific URI.

Arguments:
ownerAsciiDomain: The domain for which keys should be removed !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost

void evictUnownedEntries ( )

Evict all entries that are not owned by a domain.


void getOwnedKeys ( ACString ownerAsciiDomain , ACString ownerAsciiKey , out PRUint32 count , out arrayof char* keys )

Gets the list of resources owned by a given domain/URI pair.

Arguments:
ownerAsciiDomain: The domain that owns the resources !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
ownerAsciiKey: The specific key that owns the resources. You may use ascii encoded URI spec of the owner - nsIURI.asciiSpec. This can be empty if none specifically owns the resources.
count: The number of keys in keys.
keys: The keys that the domain/URI pair own.

void getOwnerDomains ( out PRUint32 count , out arrayof char* domains )

Gets the list of owner domains in the cache.

Arguments:
count: The number of domains returned
domains

void getOwnerURIs ( ACString ownerAsciiDomain , out PRUint32 count , out arrayof char* uris )

Gets the list of owner URIs associated with a domain.

Arguments:
ownerAsciiDomain: The domain to query !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
count: The number of uris returned
uris: The uris in this domain that own resources

PRBool keyIsOwned ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key )

Checks whether a key is owned by a given domain/URI pair.

Arguments:
ownerAsciiDomain: The domain that owns the resources !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
ownerAsciiKey: The specific key that owns the resources. You may use ascii encoded URI spec of the owner - nsIURI.asciiSpec. This can be empty if none specifically owns the resources.
key: The key to check

void mergeTemporaryClientID ( ACString temporaryClientID )

Merge the items from a temporary clientID in to this client. This lets offline cache updates accumulate in a temporary client and be moved in all at once.

Entries in the temporary client will replace any entries in this client with the same cache key.

Ownership lists for a given domain/URI pair from the temporary client will replace ownership lists for the same domain/URI pair.

Arguments:
temporaryClientID

void removeOwnedKey ( ACString ownerAsciiDomain , ACString ownerAsciiKey , ACString key )

Removes an owned key from a domain/URI pair.

If the key does not exist, an NS_ERROR_NOT_AVAILABLE exception will be thrown.

Arguments:
ownerAsciiDomain: The domain that owns the resources !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
ownerAsciiKey: The specific key that owns the resources. You may use ascii encoded URI spec of the owner - nsIURI.asciiSpec. This can be empty if none specifically owns the resources.
key: The key to remove.

void setOwnedKeys ( ACString ownerAsciiDomain , ACString ownerAsciiKey , PRUint32 count , arrayof char* keys )

Sets the resources owned by a given domain/URI pair.

Setting a list will remove any resources previously owned by this domain/URI pair.

A key can be added while there is no associated entry. When an entry is created with this key, it will be owned by the domain/URI pair.

Arguments:
ownerAsciiDomain: The domain that owns the resources !! IMPORTANT !! : This must be ascii encoded host - nsIURI.asciiHost
ownerAsciiKey: The specific key that owns the resources. You may use ascii encoded URI spec of the owner - nsIURI.asciiSpec. This can be empty if none specifically owns the resources.
count: The number of keys in keys.
keys: The keys that the domain/URI pair own. This can be empty to clear ownership for the domain/URI pair.

Reference documentation is generated from Mozilla's source.