πŸ‘‹ Introduction

Everything your project needs about Cache.

Welcome to the documentation for the Toolkitify Cache module.

Below, you will learn how to use the cache system, its settings, and utilities.

What is the Cache module used for?

The Cache module, as its name suggests, allows you to cache (calculate and store precalculated for a period of time) data, functions, and anything else that consumes resources and that you want to have precal.

Getting started

We will start with the easiest part of all, setting and then obtaining that value.


Example: The following code sets a random value in the cache with the key value and then retrieves it.

Caching a value
import { Cache } from "toolkitify/cache";

const cache = new Cache();

cache.set("key", "value");
cache.get("key");

Example: You can get all cached values using the getAll method.

Caching a function
import { Cache } from "toolkitify/cache";

const cache = new Cache();

cache.set("key", "value");
cache.set("key2", "value");
cache.set("key3", "value");
cache.getAll();