Skip to main content
Deno 2 is finally here 🎉️
Learn more
Very Popular
Go to Latest
interface StorageAdapter
import { type StorageAdapter } from "https://deno.land/x/grammy@v1.13.0/convenience/session.ts";

A storage adapter is an abstraction that provides read, write, and delete access to a storage solution of any kind. Storage adapters are used to keep session middleware independent of your database provider, and they allow you to pass your own storage solution.

Properties

read: (key: string) => MaybePromise<T | undefined>

Reads a value for the given key from the storage. May return the value or undefined, or a promise of either.

write: (key: string, value: T) => MaybePromise<void>

Writes a value for the given key to the storage.

delete: (key: string) => MaybePromise<void>

Deletes a value for the given key from the storage.