vCache

vCache is a simple cache system for caching and retrieving data based on the memory and the browser (if you're using the library on the client).

cache strategies

Memory: will cache the data in the memory, whether you're on the server or the client.
Session: only available on the client, will cache the data in the session storage.
Local: only available on the client, will cache the data in the local storage.

📑 All these strategies will have the same interface, so you can use them interchangeably and all of them will be managed by some functions that you can use to interact with the cached data.
Examples
import { vCache } from "very-good-fetch";

const cache = new vCache("memory");
// cache strategies available so far:
// memory, local, session, (cookies will be added soon + expire time for each cache -inshallah-)

// Set a value
cache.set("key", "value");
// Get a value (if it exists)
cache.get("key");
// delete a value
cache.delete("key");
// clear the cache
cache.clear();
// get all keys (array)
cache.keys();
// get all values (array)
cache.values();
// get size (number of cached items)
cache.size();
// check if a key exists
cache.has("key");
// get all cached data as an object
cache.asObject();

/** NOTE:: all these functions will be available for any cache strategy and will act exactly the same **/