netwerk/cache/nsICacheService.idl

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:edff38df242e
1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #include "nsISupports.idl"
8 #include "nsICache.idl"
9
10 interface nsISimpleEnumerator;
11 interface nsICacheListener;
12 interface nsICacheSession;
13 interface nsICacheVisitor;
14 interface nsIEventTarget;
15
16 [scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
17 interface nsICacheService : nsISupports
18 {
19 /**
20 * Create a cache session
21 *
22 * A cache session represents a client's access into the cache. The cache
23 * session is not "owned" by the cache service. Hence, it is possible to
24 * create duplicate cache sessions. Entries created by a cache session
25 * are invisible to other cache sessions, unless the cache sessions are
26 * equivalent.
27 *
28 * @param clientID - Specifies the name of the client using the cache.
29 * @param storagePolicy - Limits the storage policy for all entries
30 * accessed via the returned session. As a result, devices excluded
31 * by the storage policy will not be searched when opening entries
32 * from the returned session.
33 * @param streamBased - Indicates whether or not the data being cached
34 * can be represented as a stream. The storagePolicy must be
35 * consistent with the value of this field. For example, a non-stream-
36 * based cache entry can only have a storage policy of STORE_IN_MEMORY.
37 * @return new cache session.
38 */
39 nsICacheSession createSession(in string clientID,
40 in nsCacheStoragePolicy storagePolicy,
41 in boolean streamBased);
42
43 /**
44 * Visit entries stored in the cache. Used to implement about:cache.
45 */
46 void visitEntries(in nsICacheVisitor visitor);
47
48 /**
49 * Evicts all entries in all devices implied by the storage policy.
50 *
51 * @note This function may evict some items but will throw if it fails to evict
52 * everything.
53 */
54 void evictEntries(in nsCacheStoragePolicy storagePolicy);
55
56 /**
57 * Event target which is used for I/O operations
58 */
59 readonly attribute nsIEventTarget cacheIOTarget;
60 };
61
62 %{C++
63 /**
64 * Observer service notification that is sent when
65 * nsICacheService::evictEntries() or nsICacheSession::evictEntries()
66 * is called.
67 */
68 #define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache"
69 %}
70
71 [scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)]
72 interface nsICacheServiceInternal : nsICacheService
73 {
74 /**
75 * This is an internal interface. It changes so frequently that it probably
76 * went away while you were reading this.
77 */
78
79 /**
80 * Milliseconds for which the service lock has been held. 0 if unlocked.
81 */
82 readonly attribute double lockHeldTime;
83 };
84
85

mercurial