netwerk/cache/nsICacheService.idl

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/cache/nsICacheService.idl	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,85 @@
     1.4 +/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + *
     1.6 + * This Source Code Form is subject to the terms of the Mozilla Public
     1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.9 +
    1.10 +#include "nsISupports.idl"
    1.11 +#include "nsICache.idl"
    1.12 +
    1.13 +interface nsISimpleEnumerator;
    1.14 +interface nsICacheListener;
    1.15 +interface nsICacheSession;
    1.16 +interface nsICacheVisitor;
    1.17 +interface nsIEventTarget;
    1.18 +
    1.19 +[scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
    1.20 +interface nsICacheService : nsISupports
    1.21 +{
    1.22 +    /**
    1.23 +     * Create a cache session
    1.24 +     *
    1.25 +     * A cache session represents a client's access into the cache.  The cache
    1.26 +     * session is not "owned" by the cache service.  Hence, it is possible to
    1.27 +     * create duplicate cache sessions.  Entries created by a cache session
    1.28 +     * are invisible to other cache sessions, unless the cache sessions are
    1.29 +     * equivalent.
    1.30 +     *
    1.31 +     * @param clientID - Specifies the name of the client using the cache.
    1.32 +     * @param storagePolicy - Limits the storage policy for all entries
    1.33 +     *   accessed via the returned session.  As a result, devices excluded
    1.34 +     *   by the storage policy will not be searched when opening entries
    1.35 +     *   from the returned session.
    1.36 +     * @param streamBased - Indicates whether or not the data being cached
    1.37 +     *   can be represented as a stream.  The storagePolicy must be 
    1.38 +     *   consistent with the value of this field.  For example, a non-stream-
    1.39 +     *   based cache entry can only have a storage policy of STORE_IN_MEMORY.
    1.40 +     * @return new cache session.
    1.41 +     */
    1.42 +    nsICacheSession createSession(in string                 clientID,
    1.43 +                                  in nsCacheStoragePolicy   storagePolicy,
    1.44 +                                  in boolean                streamBased);
    1.45 +
    1.46 +    /**
    1.47 +     * Visit entries stored in the cache.  Used to implement about:cache.
    1.48 +     */
    1.49 +    void visitEntries(in nsICacheVisitor visitor);
    1.50 +
    1.51 +    /**
    1.52 +     * Evicts all entries in all devices implied by the storage policy.
    1.53 +     *
    1.54 +     * @note This function may evict some items but will throw if it fails to evict
    1.55 +     *       everything.
    1.56 +     */
    1.57 +    void evictEntries(in nsCacheStoragePolicy  storagePolicy);
    1.58 +
    1.59 +    /**
    1.60 +     * Event target which is used for I/O operations
    1.61 +     */
    1.62 +    readonly attribute nsIEventTarget cacheIOTarget;
    1.63 +};
    1.64 +
    1.65 +%{C++
    1.66 +/**
    1.67 + * Observer service notification that is sent when
    1.68 + * nsICacheService::evictEntries() or nsICacheSession::evictEntries()
    1.69 + * is called.
    1.70 + */
    1.71 +#define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache"
    1.72 +%}
    1.73 +
    1.74 +[scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)]
    1.75 +interface nsICacheServiceInternal : nsICacheService
    1.76 +{
    1.77 +    /**
    1.78 +     * This is an internal interface. It changes so frequently that it probably
    1.79 +     * went away while you were reading this.
    1.80 +     */
    1.81 +
    1.82 +    /**
    1.83 +     * Milliseconds for which the service lock has been held. 0 if unlocked.
    1.84 +     */
    1.85 +    readonly attribute double lockHeldTime;
    1.86 +};
    1.87 +
    1.88 +

mercurial