2001-02-23 22:23:55 +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 22:23:55 +00:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
2001-02-23 23:20:15 +00:00
|
|
|
#include "nsICache.idl"
|
|
|
|
|
|
|
|
interface nsICacheEntryDescriptor;
|
|
|
|
interface nsICacheListener;
|
2012-06-06 02:08:30 +00:00
|
|
|
interface nsIFile;
|
2001-02-23 23:20:15 +00:00
|
|
|
|
2012-03-22 22:54:20 +00:00
|
|
|
[scriptable, uuid(1dd7708c-de48-4ffe-b5aa-cd218c762887)]
|
2001-02-23 22:23:55 +00:00
|
|
|
interface nsICacheSession : nsISupports
|
|
|
|
{
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
2001-03-12 06:23:52 +00:00
|
|
|
* Expired entries will be doomed or evicted if this attribute is set to
|
|
|
|
* true. If false, expired entries will be returned (useful for offline-
|
|
|
|
* mode and clients, such as HTTP, that can update the valid lifetime of
|
|
|
|
* cached content). This attribute defaults to true.
|
2001-03-08 05:31:52 +00:00
|
|
|
*/
|
2011-08-07 05:03:32 +00:00
|
|
|
attribute boolean doomEntriesIfExpired;
|
2001-03-08 05:31:52 +00:00
|
|
|
|
2012-06-04 14:12:24 +00:00
|
|
|
/**
|
|
|
|
* When set, entries created with this session will be placed to a cache
|
|
|
|
* based at this directory. Use when storing entries to a different
|
|
|
|
* profile than the active profile of the the current running application
|
|
|
|
* process.
|
|
|
|
*/
|
2012-06-06 02:08:30 +00:00
|
|
|
attribute nsIFile profileDirectory;
|
2012-06-04 14:12:24 +00:00
|
|
|
|
2001-03-08 05:31:52 +00:00
|
|
|
/**
|
|
|
|
* A cache session can only give out one descriptor with WRITE access
|
|
|
|
* to a given cache entry at a time. Until the client calls MarkValid on
|
|
|
|
* its descriptor, other attempts to open the same cache entry will block.
|
2001-02-23 22:23:55 +00:00
|
|
|
*/
|
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
2012-09-18 18:06:35 +00:00
|
|
|
* Synchronous cache access. This method fails if it is called on the main
|
|
|
|
* thread. Use asyncOpenCacheEntry() instead. This returns a unique
|
|
|
|
* descriptor each time it is called, even if the same key is specified.
|
|
|
|
* When called by multiple threads for write access, only one writable
|
2001-06-28 01:30:26 +00:00
|
|
|
* descriptor will be granted. If 'blockingMode' is set to false, it will
|
|
|
|
* return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another
|
|
|
|
* descriptor has been given WRITE access but hasn't validated the entry yet.
|
2001-02-24 01:27:49 +00:00
|
|
|
*/
|
2005-01-13 03:25:28 +00:00
|
|
|
nsICacheEntryDescriptor openCacheEntry(in ACString key,
|
2001-05-09 03:36:00 +00:00
|
|
|
in nsCacheAccessMode accessRequested,
|
|
|
|
in boolean blockingMode);
|
2001-02-23 22:23:55 +00:00
|
|
|
|
2001-02-24 01:27:49 +00:00
|
|
|
/**
|
2012-03-22 22:53:10 +00:00
|
|
|
* Asynchronous cache access. Does not block the calling thread. Instead,
|
|
|
|
* the listener will be notified when the descriptor is available. If
|
|
|
|
* 'noWait' is set to true, the listener will be notified immediately with
|
|
|
|
* status NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than queuing the request
|
|
|
|
* when another descriptor has been given WRITE access but hasn't validated
|
|
|
|
* the entry yet.
|
2001-02-23 22:23:55 +00:00
|
|
|
*/
|
2012-03-22 22:53:10 +00:00
|
|
|
void asyncOpenCacheEntry(in ACString key,
|
|
|
|
in nsCacheAccessMode accessRequested,
|
|
|
|
in nsICacheListener listener,
|
|
|
|
[optional] in boolean noWait);
|
2001-03-29 05:51:46 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Evict all entries for this session's clientID according to its storagePolicy.
|
|
|
|
*/
|
|
|
|
void evictEntries();
|
2019-05-22 22:37:14 +00:00
|
|
|
|
2002-01-24 01:25:25 +00:00
|
|
|
/**
|
|
|
|
* Return whether any of the cache devices implied by the session storage policy
|
|
|
|
* are currently enabled for instantiation if they don't already exist.
|
|
|
|
*/
|
2011-08-07 05:03:32 +00:00
|
|
|
boolean isStorageEnabled();
|
2012-03-22 22:54:20 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Asynchronously doom an entry specified by the key. Listener will be
|
|
|
|
* notified about the status of the operation. Null may be passed if caller
|
|
|
|
* doesn't care about the result.
|
|
|
|
*/
|
|
|
|
void doomEntry(in ACString key, in nsICacheListener listener);
|
2012-05-24 15:31:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Private entries will be doomed when the last private browsing session
|
|
|
|
* finishes.
|
|
|
|
*/
|
|
|
|
attribute boolean isPrivate;
|
2001-02-23 22:23:55 +00:00
|
|
|
};
|