Cookie's Cache JS API

Cache Management Functions (Session Storage)

cache.set(key, value)

                    Sets an item in session storage with the provided key and value.

                    Parameters:
                    - key (string): The key to set in session storage.
                    - value (any): The value to store. Will be JSON stringified before storage.

                    Usage:
                    cache.set("userDetails", { username: "john_doe", role: "admin" });
                

cache.get(key)

                    Gets the value of the item from session storage based on the provided key.

                    Parameters:
                    - key (string): The key of the item to retrieve from session storage.

                    Returns:
                    - (any | null): Returns the parsed JSON value from session storage if found, or null if the key does not exist.

                    Usage:
                    var userDetails = cache.get("userDetails");
                

cache.delete(key)

                    Deletes the item from session storage based on the provided key.

                    Parameters:
                    - key (string): The key of the item to delete from session storage.

                    Usage:
                    cache.delete("userDetails");
                

cache.clear()

                    Clears all items from session storage.

                    Usage:
                    cache.clear();