michael@0: /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: #include "nsICache.idl" michael@0: michael@0: interface nsISimpleEnumerator; michael@0: interface nsICacheListener; michael@0: interface nsICacheSession; michael@0: interface nsICacheVisitor; michael@0: interface nsIEventTarget; michael@0: michael@0: [scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)] michael@0: interface nsICacheService : nsISupports michael@0: { michael@0: /** michael@0: * Create a cache session michael@0: * michael@0: * A cache session represents a client's access into the cache. The cache michael@0: * session is not "owned" by the cache service. Hence, it is possible to michael@0: * create duplicate cache sessions. Entries created by a cache session michael@0: * are invisible to other cache sessions, unless the cache sessions are michael@0: * equivalent. michael@0: * michael@0: * @param clientID - Specifies the name of the client using the cache. michael@0: * @param storagePolicy - Limits the storage policy for all entries michael@0: * accessed via the returned session. As a result, devices excluded michael@0: * by the storage policy will not be searched when opening entries michael@0: * from the returned session. michael@0: * @param streamBased - Indicates whether or not the data being cached michael@0: * can be represented as a stream. The storagePolicy must be michael@0: * consistent with the value of this field. For example, a non-stream- michael@0: * based cache entry can only have a storage policy of STORE_IN_MEMORY. michael@0: * @return new cache session. michael@0: */ michael@0: nsICacheSession createSession(in string clientID, michael@0: in nsCacheStoragePolicy storagePolicy, michael@0: in boolean streamBased); michael@0: michael@0: /** michael@0: * Visit entries stored in the cache. Used to implement about:cache. michael@0: */ michael@0: void visitEntries(in nsICacheVisitor visitor); michael@0: michael@0: /** michael@0: * Evicts all entries in all devices implied by the storage policy. michael@0: * michael@0: * @note This function may evict some items but will throw if it fails to evict michael@0: * everything. michael@0: */ michael@0: void evictEntries(in nsCacheStoragePolicy storagePolicy); michael@0: michael@0: /** michael@0: * Event target which is used for I/O operations michael@0: */ michael@0: readonly attribute nsIEventTarget cacheIOTarget; michael@0: }; michael@0: michael@0: %{C++ michael@0: /** michael@0: * Observer service notification that is sent when michael@0: * nsICacheService::evictEntries() or nsICacheSession::evictEntries() michael@0: * is called. michael@0: */ michael@0: #define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache" michael@0: %} michael@0: michael@0: [scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)] michael@0: interface nsICacheServiceInternal : nsICacheService michael@0: { michael@0: /** michael@0: * This is an internal interface. It changes so frequently that it probably michael@0: * went away while you were reading this. michael@0: */ michael@0: michael@0: /** michael@0: * Milliseconds for which the service lock has been held. 0 if unlocked. michael@0: */ michael@0: readonly attribute double lockHeldTime; michael@0: }; michael@0: michael@0: