2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
|
|
|
*
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
#include "nsICache.idl"
|
|
|
|
|
|
|
|
interface nsISimpleEnumerator;
|
|
|
|
interface nsICacheListener;
|
|
|
|
interface nsICacheSession;
|
|
|
|
interface nsICacheVisitor;
|
2010-08-23 18:06:23 -07:00
|
|
|
interface nsIEventTarget;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-08-23 18:06:23 -07:00
|
|
|
[scriptable, uuid(14dbe1e9-f3bc-45af-92f4-2c574fcd4e39)]
|
2007-03-22 10:30:00 -07:00
|
|
|
interface nsICacheService : nsISupports
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
nsICacheSession createSession(in string clientID,
|
|
|
|
in nsCacheStoragePolicy storagePolicy,
|
|
|
|
in boolean streamBased);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Visit entries stored in the cache. Used to implement about:cache.
|
|
|
|
*/
|
|
|
|
void visitEntries(in nsICacheVisitor visitor);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Evicts all entries in all devices implied by the storage policy.
|
2010-05-24 05:25:59 -07:00
|
|
|
*
|
|
|
|
* @note This function may evict some items but will throw if it fails to evict
|
|
|
|
* everything.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
|
|
|
void evictEntries(in nsCacheStoragePolicy storagePolicy);
|
2010-08-23 18:06:23 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Event target which is used for I/O operations
|
|
|
|
*/
|
|
|
|
readonly attribute nsIEventTarget cacheIOTarget;
|
2007-03-22 10:30:00 -07: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"
|
|
|
|
%}
|