跳到主要内容

CacheStorage🧪

✅️️ Methods

🔨CacheStorage.deleteCache

删除一个缓存。

EN
Deletes a cache.
参数必填标记类型描述原文
cacheId✔️CacheId用于删除的缓存ID。
ENId of cache for deletion.

🔨CacheStorage.deleteEntry

删除一个缓存条目。

EN
Deletes a cache entry.
参数必填标记类型描述原文
cacheId✔️CacheId要删除条目的缓存ID。
ENId of cache where the entry will be deleted.
request✔️string请求的URL规范。
ENURL spec of the request.

🔨CacheStorage.requestCachedResponse

获取缓存条目。

EN
Fetches cache entry.
参数必填标记类型描述原文
cacheId✔️CacheId包含条目的缓存ID。
ENId of cache that contains the entry.
requestURL✔️string请求的URL规范。
ENURL spec of the request.
requestHeaders✔️array[Header]请求的头部信息。
ENheaders of the request.
返回对象类型描述原文
responseCachedResponse从缓存中读取响应。
ENResponse read from the cache.

🔨CacheStorage.requestCacheNames

请求缓存名称。

EN
Requests cache names.
参数必填标记类型描述原文
securityOriginstring至少且最多必须指定 securityOriginstorageKeystorageBucket 中的一个。安全来源。
ENAt least and at most one of securityOrigin, storageKey, storageBucket must be specified. Security origin.
storageKeystring存储键。
ENStorage key.
storageBucketStorage.StorageBucket存储桶。如果未指定,则使用默认桶。
ENStorage bucket. If not specified, it uses the default bucket.
返回对象类型描述原文
cachesarray[Cache]安全源的缓存。
ENCaches for the security origin.

🔨CacheStorage.requestEntries

从缓存中请求数据。

EN
Requests data from cache.
参数必填标记类型描述原文
cacheId✔️CacheId从中获取条目的缓存ID。
ENID of cache to get entries from.
skipCountinteger要跳过的记录数量。
ENNumber of records to skip.
pageSizeinteger要获取的记录数量。
ENNumber of records to fetch.
pathFilterstring如果存在,仅返回路径中包含此子字符串的条目
ENIf present, only return the entries containing this substring in the path
返回对象类型描述原文
cacheDataEntriesarray[DataEntry]对象存储数据条目数组。
ENArray of object store data entries.
returnCountnumber从此存储返回的条目数量。如果 pathFilter 为空,则表示此存储中所有条目的总数。
ENCount of returned entries from this storage. If pathFilter is empty, it is the count of all entries from this storage.

✅️️ Types

📌CacheStorage.Cache

缓存标识符。

EN
Cache identifier.

返回类型:object

属性必填标记类型描述原文
cacheId✔️CacheId缓存的唯一不透明标识符。
ENAn opaque unique id of the cache.
securityOrigin✔️string缓存的安全来源。
ENSecurity origin of the cache.
storageKey✔️string缓存存储键。
ENStorage key of the cache.
storageBucketStorage.StorageBucket缓存存储桶。
ENStorage bucket of the cache.
cacheName✔️string缓存的名称。
ENThe name of the cache.

📌CacheStorage.CachedResponse

缓存响应

EN
Cached response

返回类型:object

属性必填标记类型描述原文
body✔️string条目内容,采用Base64编码。(在通过JSON传递时编码为base64字符串)
ENEntry content, base64-encoded. (Encoded as a base64 string when passed over JSON)

📌CacheStorage.CachedResponseType

HTTP响应缓存的类型
允许的值:basiccorsdefaulterroropaqueResponseopaqueRedirect

EN
type of HTTP response cached
Allowed Values: basic, cors, default, error, opaqueResponse, opaqueRedirect

返回类型:string


📌CacheStorage.CacheId

Cache对象的唯一标识符。

EN
Unique identifier of the Cache object.

返回类型:string


📌CacheStorage.DataEntry

数据输入。

EN
Data entry.

返回类型:object

属性必填标记类型描述原文
requestURL✔️stringRequest URL.
ENRequest URL.
requestMethod✔️string请求方法。
ENRequest method.
requestHeaders✔️array[Header]请求头
ENRequest headers
responseTime✔️number自纪元以来的秒数。
ENNumber of seconds since epoch.
responseStatus✔️integerHTTP响应状态码。
ENHTTP response status code.
responseStatusText✔️stringHTTP 响应状态文本。
ENHTTP response status text.
responseType✔️CachedResponseTypeHTTP响应类型
ENHTTP response type
responseHeaders✔️array[Header]响应头部
ENResponse headers

📌CacheStorage.Header

返回类型:object

属性必填标记类型描述原文
name✔️string
value✔️string