whether the cache is empty.
Clears all stored data.
This also notifies registered subscribers (see subscribe) unless the notifySubscribers option is set to false.
Optionaloptions: { notifySubscribers: boolean }the data for the given key, or undefined if there is no data.
To solely check for existence of a key, use has.
Removes the data for the given key. This also notifies registered subscribers (see subscribe).
true if data for the key was removed, false otherwise.
Sets the data for the given key.
If the data exceeds the configured capacity, the least recently used entries are removed.
This also notifies registered subscribers (see subscribe).
Registers a new subscriber that gets notified when cache data is set or removed.
a function that can be called to remove the subscriber.
Caching abstraction that stores data on disk and supports LRU (least recently used) access. Values can only be stored as plain text strings, so it is up to you to serialize your data in an appropriate way. For instance, you could store json using
JSON.stringifyandJSON.parseit back. If you need to store binary data, you could encode it in base64.Unlike the local storage API, this API exclusively uses the extension's support directory to store its data. No calls to internal Vicinae APIs are required, hence why all methods in this class are synchronous. Another major difference is that cache data is not encrypted, so it's not suitable to store secrets. (local storage currently isn't either, but that will change in the future)