Interface nsICacheEntryType

Hierarchy

Properties

altDataSize: number

Returns the length of data this entry holds.

Throws

  • NS_ERROR_IN_PROGRESS when a write is still in progress (either real content or alt data).
  • NS_ERROR_NOT_AVAILABLE if alt data does not exist.
altDataType: string

Returns the type of the saved alt data.

Throws

  • NS_ERROR_NOT_AVAILABLE if alt data does not exist.
cacheEntryId: uint64_t

The unique ID for every nsICacheEntry instance, which can be used to check whether two pieces of information are from the same nsICacheEntry instance.

dataSize: number

Returns the length of data this entry holds.

Throws

NS_ERROR_IN_PROGRESS when the write is still in progress.

diskStorageSizeInKB: uint32_t

Returns the size in kilobytes used to store the cache entry on disk.

expirationTime: uint32_t

Get the expiration time of the cache entry (in seconds since the Epoch).

fetchCount: uint32_t

Get the number of times the cache entry has been opened.

isForcedValid: boolean

The state variable for whether this entry is currently forced valid. Defaults to false for normal cache validation behavior, and will return true if the number of seconds set by forceValidFor() has yet to be reached.

key: string

Get the key identifying the cache entry.

lastFetched: uint32_t

Get the last time the cache entry was opened (in seconds since the Epoch).

lastModified: uint32_t

Get the last time the cache entry was modified (in seconds since the Epoch).

loadContextInfo: nsILoadContextInfo

Get the nsILoadContextInfo of the cache entry

onStartTime: uint64_t

Get the last network response times for onStartReqeust/onStopRequest (in ms).

Throws

  • NS_ERROR_NOT_AVAILABLE if onStartTime/onStopTime does not exist.
onStopTime: uint64_t
persistent: boolean

Whether the entry is memory/only or persisted to disk. Note: private browsing entries are reported as persistent for consistency while are not actually persisted to disk.

securityInfo: nsITransportSecurityInfo

Get/set security info on the cache entry for this descriptor.

storageDataSize: number

Get the size of the cache entry data, as stored. This may differ from the entry's dataSize, if the entry is compressed.

Methods

  • Increases the reference count for this interface. The associated instance will not be deleted unless the reference count is returned to zero.

    Returns

    The resulting reference count.

    Returns number

  • Parameters

    • aIID: object
    • Optional aInstancePtr: object

    Returns any

  • A run time mechanism for interface discovery.

    Returns

    NS_OK if the interface is supported by the associated instance, NS_NOINTERFACE if it is not.

    aInstancePtr must not be null.

    Parameters

    • aIID: object

      [in] A requested interface IID

    • aInstancePtr: object

      [out] A pointer to an interface pointer to receive the result.

    Returns void

  • Decreases the reference count for this interface. Generally, if the reference count returns to zero, the associated instance is deleted.

    Returns

    The resulting reference count.

    Returns number

  • Asynchronously doom an entry. Listener will be notified about the status of the operation. Null may be passed if caller doesn't care about the result.

    Parameters

    • listener: nsICacheEntryDoomCallback

    Returns void


  • The following methods might be added to some nsICacheEntryInternal interface since we want to remove them as soon as the old cache backend is completely removed.

    Deprecated

    FOR BACKWARD COMPATIBILITY ONLY When the old cache backend is eventually removed, this method can be removed too.

    In the new backend: this method is no-op In the old backend: this method delegates to nsICacheEntryDescriptor.close()

    Returns void

  • Explicitly tell the cache backend this consumer is no longer going to modify this cache entry data or metadata. In case the consumer was responsible to either of writing the cache entry or revalidating it, calling this method reverts the state to initial (as never written) or as not-validated and immediately notifies the next consumer in line waiting for this entry. This is the way to prevent deadlocks when someone else than the responsible channel references the cache entry being in a non-written or revalidating state.

    Returns void

  • This method is intended to override the per-spec cache validation decisions for a duration specified in seconds. The current state can be examined with isForcedValid (see below). This value is not persisted, so it will not survive session restart. Cache entries that are forced valid will not be evicted from the cache for the duration of forced validity. This means that there is a potential problem if the number of forced valid entries grows to take up more space than the cache size allows.

    NOTE: entries that have been forced valid will STILL be ignored by HTTP channels if they have expired AND the resource in question requires validation after expiring. This is to avoid using known-stale content.

    Parameters

    • aSecondsToTheFuture: number

      the number of seconds the default cache validation behavior will be overridden before it returns to normal

    Returns void

  • Methods for accessing meta data. Meta data is a table of key/value string pairs. The strings do not have to conform to any particular charset, but they must be null terminated.

    Parameters

    • key: string

    Returns string

  • Deprecated

    FOR BACKWARD COMPATIBILITY ONLY / KINDA HACK

    Returns

    true when write access is acquired for this entry, false otherwise

    Parameters

    • aWriteAllowed: boolean

      Consumer indicates whether write to the entry is allowed for it. Depends on implementation how the flag is handled.

    Returns boolean

  • This method gets called to mark the actual use of the forced-valid entry. This is necessary for telemetry, so when the entry eventually gets evicted we can report whether it was ever used or not. If the entry was not forced-valid, then this operation has no effect.

    Returns void

  • Deprecated

    FOR BACKWARD COMPATIBILITY ONLY Marks the entry as valid so that others can use it and get only readonly access when the entry is held by the 1st writer.

    Returns void

  • Deprecated

    FOR BACKWARD COMPATIBILITY ONLY Marks the entry as valid when write access is acquired.

    Returns void

  • Claims that all metadata on this entry are up-to-date and this entry now can be delivered to other waiting consumers.

    We need such method since metadata must be delivered synchronously.

    Returns void

  • Opens and returns an input stream that can be used to read the alternative representation previously saved in the cache. If this call is made while writing alt-data is still in progress, it is still possible to read content from the input stream as it's being written.

    Throws

    • NS_ERROR_NOT_AVAILABLE if the alt-data representation doesn't exist at all or if alt-data of the given type doesn't exist.

    Parameters

    • type: string

    Returns nsIInputStream

  • Opens and returns an output stream that a consumer may use to save an alternate representation of the data.

    Throws

    • NS_ERROR_NOT_AVAILABLE if the real data hasn't been written.
    • NS_ERROR_IN_PROGRESS when the writing regular content or alt-data to the cache entry is still in progress.

    If there is alt-data already saved, it will be overwritten.

    Parameters

    • type: string

      type of the alternative data representation

    • predictedSize: number

      Predicted size of the data that will be written. It's used to decide whether the resulting entry would exceed size limit, in which case an error is thrown. If the size isn't known in advance, -1 should be passed.

    Returns nsIAsyncOutputStream

  • Open blocking input stream to cache data. Use the stream transport service to asynchronously read this stream on a background thread. The returned stream MAY implement nsISeekableStream.

    Returns

    non-blocking, buffered input stream.

    Parameters

    • offset: number

      read starting from this offset into the cached data. an offset beyond the end of the stream has undefined consequences.

    Returns nsIInputStream

  • Open non-blocking output stream to cache data. The returned stream MAY implement nsISeekableStream.

    If opening an output stream to existing cached data, the data will be truncated to the specified offset.

    Returns

    blocking, buffered output stream.

    Parameters

    • offset: number

      write starting from this offset into the cached data. an offset beyond the end of the stream has undefined consequences.

    • predictedSize: number

      Predicted size of the data that will be written. It's used to decide whether the resulting entry would exceed size limit, in which case an error is thrown. If the size isn't known in advance, -1 should be passed.

    Returns nsIOutputStream

  • Doom this entry and open a new, empty, entry for write. Consumer has to exchange the entry this method is called on for the newly created. Used on 200 responses to conditional requests.

    Returns

    • an entry that can be used to write to

    Throws

    • NS_ERROR_NOT_AVAILABLE when the entry cannot be from some reason recreated for write

    Parameters

    • aMemoryOnly: boolean

      whether the entry is to be created as memory/only regardless how the entry being recreated persistence is set

    Returns nsICacheEntry

  • Set content type. Available types are defined at the begining of this file. The content type is used internally for cache partitioning and telemetry purposes so there is no getter.

    Parameters

    • contentType: uint8_t

    Returns void

  • Set the time at which the cache entry should be considered invalid (in seconds since the Epoch).

    Parameters

    • expirationTime: uint32_t

    Returns void

  • Parameters

    • key: string
    • value: string

    Returns void

  • Set the network response times for onStartReqeust/onStopRequest (in ms).

    Parameters

    • onStartTime: uint64_t
    • onStopTime: uint64_t

    Returns void

  • Called by consumer upon 304/206 response from the server. This marks the entry content as positively revalidated. Consumer uses this method after the consumer has returned ENTRY_NEEDS_REVALIDATION result from onCacheEntryCheck and after successfull revalidation with the server.

    Returns void

  • Obtain the list of metadata keys this entry keeps.

    NOTE: The callback is invoked under the CacheFile's lock. It means there should not be made any calls to the entry from the visitor and if the values need to be processed somehow, it's better to cache them and process outside the callback.

    Parameters

    • visitor: nsICacheEntryMetaDataVisitor

    Returns void

Generated using TypeDoc