Application caches store resources for offline use. Each application cache has a unique client ID for use with nsICacheService::openSession() to access the cache's entries. Each entry in the application cache can be marked with a set of types, as discussed in the WHAT-WG offline applications specification. All application caches with the same group ID belong to a cache group. Each group has one "active" cache that will service future loads. Inactive caches will be removed from the cache when they are no longer referenced.
[scriptable, uuid(663e2e2e-04a0-47b6-87b3-a122be46cb53)]
interface nsIApplicationCache : nsISupports
Constants
Entries in an application cache can be marked as one or more of the following types.
const
unsigned long
ITEM_MANIFEST = 1
const
unsigned long
ITEM_EXPLICIT = 2
const
unsigned long
ITEM_IMPLICIT = 4
const
unsigned long
ITEM_DYNAMIC = 8
const
unsigned long
ITEM_FOREIGN = 16
const
unsigned long
ITEM_FALLBACK = 32
const
unsigned long
ITEM_OPPORTUNISTIC = 64
Attributes
TRUE if the cache is the active cache for this group.
readonly attribute
boolean
active
The client ID for this application cache. Clients can open a session with nsICacheService::createSession() using this client ID and a storage policy of STORE_OFFLINE to access this cache.
readonly attribute
ACString
clientID
The group ID for this cache group. This is the URI of the manifest file.
readonly attribute
ACString
groupID
The disk usage of the application cache, in bytes.
readonly attribute
unsigned long
usage
Methods
Makes this cache the active application cache for this group. Future loads associated with this group will come from this cache. Other caches from this cache group will be deactivated.
void
activate()
Add a set of namespace entries to the application cache.
@param namespaces
An nsIArray of nsIApplicationCacheNamespace entries.
void
addNamespaces(in nsIArray namespaces)
Discard this application cache. Removes all cached resources for this cache. If this is the active application cache for the group, the group will be removed.
void
discard()
Returns any entries in the application cache whose type matches one or more of the bits in typeBits.
void
gatherEntries(in PRUint32 typeBits, out unsigned long count, [array, size_is(count)] out string keys)
Get the most specific namespace matching a given key.
nsIApplicationCacheNamespace
getMatchingNamespace(in ACString key)
Gets the types for a given entry.
unsigned long
getTypes(in ACString key)
Adds item types to a given entry.
void
markEntry(in ACString key, in unsigned long typeBits)
Removes types from a given entry. If the resulting entry has no types left, the entry is removed.
void
unmarkEntry(in ACString key, in unsigned long typeBits)
Compare to: