---
title: "CacheStorage | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Interface CacheStorage

The **`CacheStorage`** interface represents the storage for Cache objects. Available only in secure contexts.

[MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage)

interface CacheStorage {  
    [delete](#delete-1)(cacheName: string): Promise<boolean\>;  
    [has](#has-1)(cacheName: string): Promise<boolean\>;  
    [keys](#keys-1)(): Promise<string\[\]\>;  
    [match](#match-1)(  
        request: [RequestInfo](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RequestInfo/) | URL,  
        options?: [MultiCacheQueryOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.MultiCacheQueryOptions/),  
    ): Promise<Response | undefined\>;  
    [open](#open-1)(cacheName: string): Promise<[Cache](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Cache/)\>;  
}

##### Index

### Methods[](#methods)

[delete](#delete) [has](#has) [keys](#keys) [match](#match) [open](#open)

## Methods[](#methods-1)

### delete[](#delete)

-   delete(cacheName: string): Promise<boolean\>[](#delete-1)
    
    The **`delete()`** method of the CacheStorage interface finds the Cache object matching the cacheName, and if found, deletes the Cache object and returns a Promise that resolves to true. If no Cache object is found, it resolves to false.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/delete)
    
    #### Parameters
    
    -   cacheName: string
    
    #### Returns Promise<boolean\>
    

### has[](#has)

-   has(cacheName: string): Promise<boolean\>[](#has-1)
    
    The **`has()`** method of the CacheStorage interface returns a Promise that resolves to true if a Cache object matches the cacheName.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/has)
    
    #### Parameters
    
    -   cacheName: string
    
    #### Returns Promise<boolean\>
    

### keys[](#keys)

-   keys(): Promise<string\[\]\>[](#keys-1)
    
    The **`keys()`** method of the CacheStorage interface returns a Promise that will resolve with an array containing strings corresponding to all of the named Cache objects tracked by the CacheStorage object in the order they were created. Use this method to iterate over a list of all Cache objects.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/keys)
    
    #### Returns Promise<string\[\]\>
    

### match[](#match)

-   match(  
        request: [RequestInfo](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RequestInfo/) | URL,  
        options?: [MultiCacheQueryOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.MultiCacheQueryOptions/),  
    ): Promise<Response | undefined\>[](#match-1)
    
    The **`match()`** method of the CacheStorage interface checks if a given Request or URL string is a key for a stored Response. This method returns a Promise for a Response, or a Promise which resolves to undefined if no match is found.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/match)
    
    #### Parameters
    
    -   request: [RequestInfo](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.RequestInfo/) | URL
    -   `Optional`options: [MultiCacheQueryOptions](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.MultiCacheQueryOptions/)
    
    #### Returns Promise<Response | undefined\>
    

### open[](#open)

-   open(cacheName: string): Promise<[Cache](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Cache/)\>[](#open-1)
    
    The **`open()`** method of the CacheStorage interface returns a Promise that resolves to the Cache object matching the cacheName.
    
    [MDN Reference](https://developer.mozilla.org/docs/Web/API/CacheStorage/open)
    
    #### Parameters
    
    -   cacheName: string
    
    #### Returns Promise<[Cache](https://docs.maptiler.com/sdk-js/api-reference/interfaces/Externals.Cache/)\>
