--- title: ServiceWorkerGlobalScope.caches slug: conflicting/Web/API/caches translation_of: Web/API/ServiceWorkerGlobalScope/caches original_slug: Web/API/ServiceWorkerGlobalScope/caches ---

{{APIRef("Service Workers API")}}

caches 是一个 {{domxref("ServiceWorkerGlobalScope")}} 接口的只读属性,返回与当前service worker相关联的{{domxref("CacheStorage")}}对象。

语法

var myCacheStorage = self.caches;

返回值

一个 {{domxref("CacheStorage")}} 对象。

规范

规范 状态 备注
{{SpecName('Service Workers', '#global-caches', 'ServiceWorkerGlobalScope.caches')}} {{Spec2('Service Workers')}} Initial definition.

浏览器兼容性

{{Compat("api.ServiceWorkerGlobalScope.caches")}}

参见