Skip to main content
Module

x/harmony/mod.ts>ICacheAdapter

An easy to use Discord API Library for Deno.
Latest
interface ICacheAdapter
Re-export
import { type ICacheAdapter } from "https://deno.land/x/harmony@v2.9.0/mod.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