Cache
API Reference
Cache
Signature
constructor(options: Cache.Options): CacheExample
import { List, Cache } from "@raycast/api"; type Item = { id: string; title: string }; const cache = new Cache(); cache.set("items", JSON.stringify([{ id: "1", title: "Item 1" }])); export default function Command() { const cached = cache.get("items"); const items: Item[] = cached ? JSON.parse(cached) : []; return ( <List> {items.map((item) => ( <List.Item key={item.id} title={item.title} /> ))} </List> ); }Properties
Property
Description
Type
Methods
Method
Cache#get
Signature
Parameters
Name
Description
Type
Cache#has
Signature
Parameters
Name
Description
Type
Cache#set
Signature
Parameters
Name
Description
Type
Cache#remove
Signature
Cache#clear
Signature
Parameters
Name
Description
Type
Cache#subscribe
Signature
Parameters
Name
Description
Type
Types
Cache.Options
Properties
Property
Description
Type
Cache.Subscriber
Cache.Subscription
Last updated

