InMemoryCacheStorageBackend Class
A CacheStorageBackend that keeps the caches in memory: the default backend of the browsing contexts (see BrowsingContextOptions.CacheStorage). It is thread-safe, and can be shared by several browsing contexts.
public sealed class InMemoryCacheStorageBackend : CacheStorageBackend- Inheritance
CacheStorageBackendInMemoryCacheStorageBackend
Constructors
| Name | Description |
|---|---|
| InMemoryCacheStorageBackend() |
InMemoryCacheStorageBackend()
InMemoryCacheStorageBackend.cspublic InMemoryCacheStorageBackend()No documentation is available.
Methods
| Name | Description |
|---|---|
| ApplyBatch(string, string, IReadOnlyList<long>, IReadOnlyList<CacheEntry>) | Changes the entries of a cache atomically (https://w3c.github.io/ServiceWorker/#batch-cache-operations): removes the entries with the ids of removedEntryIds, then appends addedEntries (whose ids are assigned by the backend, greater than the ids of the existing entries). |
| CreateCache(string, string) | Creates an empty cache, and returns true, or returns false when the cache exists. |
| DeleteCache(string, string) | Deletes a cache and its entries, and returns true, or returns false when the cache does not exist. |
| GetCacheNames(string) | Returns the names of the caches of an origin, in creation order (https://w3c.github.io/ServiceWorker/#cache-storage-keys). |
| GetEntries(string, string, string?) | Returns the entries of a cache, in insertion order: all the entries, or the entries whose request URL without its query and its fragment (see CachedRequest.UrlWithoutQuery) is urlWithoutQuery. The library filters the entries further (the query, the method and the Vary header). |
| GetUsage(string) | Returns an estimation of the number of bytes used by the caches of an origin (navigator.storage.estimate()). The default is 0: the usage is not reported. |
ApplyBatch(string, string, IReadOnlyList<long>, IReadOnlyList<CacheEntry>)
InMemoryCacheStorageBackend.csChanges the entries of a cache atomically (https://w3c.github.io/ServiceWorker/#batch-cache-operations): removes the entries with the ids of removedEntryIds, then appends addedEntries (whose ids are assigned by the backend, greater than the ids of the existing entries).
public override void ApplyBatch(string origin, string name, IReadOnlyList<long> removedEntryIds, IReadOnlyList<CacheEntry> addedEntries)Parameters
originstring- The serialization of the origin.
namestring- The name of the cache.
removedEntryIdsIReadOnlyList<long>- The ids of the entries to remove.
addedEntriesIReadOnlyList<CacheEntry>- The entries to append.
CreateCache(string, string)
InMemoryCacheStorageBackend.csDeleteCache(string, string)
InMemoryCacheStorageBackend.csGetCacheNames(string)
InMemoryCacheStorageBackend.csReturns the names of the caches of an origin, in creation order (https://w3c.github.io/ServiceWorker/#cache-storage-keys).
public override IReadOnlyList<string> GetCacheNames(string origin)GetEntries(string, string, string?)
InMemoryCacheStorageBackend.csReturns the entries of a cache, in insertion order: all the entries, or the entries whose request URL without its query and its fragment (see CachedRequest.UrlWithoutQuery) is urlWithoutQuery. The library filters the entries further (the query, the method and the Vary header).
public override IReadOnlyList<CacheEntry> GetEntries(string origin, string name, string? urlWithoutQuery)