2001-02-23 00:11:10 +00:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 11:12:37 +00:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2001-02-26 15:53:31 +00:00
|
|
|
#include "nsICache.idl"
|
2001-02-23 00:11:10 +00:00
|
|
|
|
|
|
|
interface nsISimpleEnumerator;
|
|
|
|
interface nsICacheListener;
|
2001-02-23 23:20:15 +00:00
|
|
|
interface nsICacheSession;
|
|
|
|
interface nsICacheVisitor;
|
2010-08-24 01:06:23 +00:00
|
|
|
interface nsIEventTarget;
|
2001-02-23 00:11:10 +00:00
|
|
|
|
2014-06-05 18:14:07 +00:00
|
|
|
/**
|
|
|
|
* @deprecated
|
|
|
|
*
|
|
|
|
* IMPORTANT NOTE: THIS INTERFACE IS NO LONGER SUPPORTED AND PLANNED TO BE
|
|
|
|
* REMOVED SOON. WE STRONGLY ENCORAGE TO MIGRATE THE EXISTING CODE AND FOR
|
|
|
|
* THE NEW CODE USE ONLY THE NEW HTTP CACHE API IN netwerk/cache2/.
|
|
|
|
*/
|
2010-08-24 01:06:23 +00:00
|
|
|
[scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
|
2001-02-23 00:11:10 +00:00
|
|
|
interface nsICacheService : nsISupports
|
|
|
|
{
|
2001-03-29 05:51:46 +00:00
|
|
|
/**
|
2014-06-05 18:14:07 +00:00
|
|
|
* @throws NS_ERROR_NOT_IMPLEMENTED when the cache v2 is prefered to use.
|
|
|
|
*
|
2001-02-24 01:27:49 +00:00
|
|
|
* Create a cache session
|
|
|
|
*
|
|
|
|
* A cache session represents a client's access into the cache. The cache
|
|
|
|
* session is not "owned" by the cache service. Hence, it is possible to
|
|
|
|
* create duplicate cache sessions. Entries created by a cache session
|
|
|
|
* are invisible to other cache sessions, unless the cache sessions are
|
|
|
|
* equivalent.
|
|
|
|
*
|
|
|
|
* @param clientID - Specifies the name of the client using the cache.
|
|
|
|
* @param storagePolicy - Limits the storage policy for all entries
|
|
|
|
* accessed via the returned session. As a result, devices excluded
|
|
|
|
* by the storage policy will not be searched when opening entries
|
|
|
|
* from the returned session.
|
|
|
|
* @param streamBased - Indicates whether or not the data being cached
|
|
|
|
* can be represented as a stream. The storagePolicy must be
|
|
|
|
* consistent with the value of this field. For example, a non-stream-
|
|
|
|
* based cache entry can only have a storage policy of STORE_IN_MEMORY.
|
|
|
|
* @return new cache session.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-26 15:53:31 +00:00
|
|
|
nsICacheSession createSession(in string clientID,
|
|
|
|
in nsCacheStoragePolicy storagePolicy,
|
|
|
|
in boolean streamBased);
|
2001-02-23 00:11:10 +00:00
|
|
|
|
2001-03-29 05:51:46 +00:00
|
|
|
/**
|
2014-06-05 18:14:07 +00:00
|
|
|
* @throws NS_ERROR_NOT_IMPLEMENTED when the cache v2 is prefered to use.
|
|
|
|
*
|
2001-02-24 01:27:49 +00:00
|
|
|
* Visit entries stored in the cache. Used to implement about:cache.
|
2001-02-23 00:11:10 +00:00
|
|
|
*/
|
2001-02-23 23:20:15 +00:00
|
|
|
void visitEntries(in nsICacheVisitor visitor);
|
2001-03-29 05:51:46 +00:00
|
|
|
|
|
|
|
/**
|
2014-06-05 18:14:07 +00:00
|
|
|
* @throws NS_ERROR_NOT_IMPLEMENTED when the cache v2 is prefered to use.
|
|
|
|
*
|
2001-03-29 05:51:46 +00:00
|
|
|
* Evicts all entries in all devices implied by the storage policy.
|
2010-05-24 12:25:59 +00:00
|
|
|
*
|
|
|
|
* @note This function may evict some items but will throw if it fails to evict
|
|
|
|
* everything.
|
2001-03-29 05:51:46 +00:00
|
|
|
*/
|
|
|
|
void evictEntries(in nsCacheStoragePolicy storagePolicy);
|
2010-08-24 01:06:23 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Event target which is used for I/O operations
|
|
|
|
*/
|
|
|
|
readonly attribute nsIEventTarget cacheIOTarget;
|
2001-02-23 00:11:10 +00:00
|
|
|
};
|
2005-09-29 20:24:27 +00:00
|
|
|
|
|
|
|
%{C++
|
|
|
|
/**
|
|
|
|
* Observer service notification that is sent when
|
|
|
|
* nsICacheService::evictEntries() or nsICacheSession::evictEntries()
|
|
|
|
* is called.
|
|
|
|
*/
|
|
|
|
#define NS_CACHESERVICE_EMPTYCACHE_TOPIC_ID "cacheservice:empty-cache"
|
|
|
|
%}
|
2013-05-12 14:01:13 +00:00
|
|
|
|
|
|
|
[scriptable, builtinclass, uuid(d0fc8d38-db80-4928-bf1c-b0085ddfa9dc)]
|
|
|
|
interface nsICacheServiceInternal : nsICacheService
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* This is an internal interface. It changes so frequently that it probably
|
|
|
|
* went away while you were reading this.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Milliseconds for which the service lock has been held. 0 if unlocked.
|
|
|
|
*/
|
|
|
|
readonly attribute double lockHeldTime;
|
|
|
|
};
|
|
|
|
|
|
|
|
|