Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/harmony/src/cache/adapter.ts>ICacheAdapter

An easy to use Discord API Library for Deno.
Go to Latest
interface ICacheAdapter
import { type ICacheAdapter } from "https://deno.land/x/harmony@v2.8.0/src/cache/adapter.ts";

ICacheAdapter is the interface to be implemented by Cache Adapters for them to be usable with Harmony.

Methods can return Promises too.

Properties

get: <T>(cacheName: string, key: string) => Promise<T | undefined> | T | undefined

Gets a key from a Cache

set: <T>(
cacheName: string,
key: string,
value: T,
expire?: number,
) => Promise<void> | void

Sets a key to value in a Cache Name with optional expire value in MS

delete: (cacheName: string, ...keys: string[]) => Promise<boolean> | boolean

Deletes a key from a Cache

array: <T>(cacheName: string) => undefined | T[] | Promise<T[] | undefined>

Gets array of all values in a Cache

deleteCache: (cacheName: string) => boolean | Promise<boolean>

Entirely deletes a Cache

size: <T>(cacheName: string, filter?: (payload: T) => boolean) => number | undefined | Promise<number | undefined>

Get size (length) of entries in a Cache

keys: (cacheName: string) => string[] | undefined | Promise<string[] | undefined>

Gets all keys of the Cache