Skip to main content
Version: 6.2

CacheAdapter

Hierarchy

Implemented by

Index

Methods

clear

  • clear(): void | Promise<void>
  • Clears all items stored in the cache.


    Returns void | Promise<void>

optionalclose

  • close(): void | Promise<void>
  • Called inside MikroORM.close() Allows graceful shutdowns (e.g. for redis).


    Returns void | Promise<void>

get

  • get<T>(name: string): undefined | T | Promise<undefined | T>
  • Gets the items under name key from the cache.


    Type parameters

    • T = any

    Parameters

    • name: string

    Returns undefined | T | Promise<undefined | T>

remove

  • remove(name: string): void | Promise<void>
  • Removes the item from cache.


    Parameters

    • name: string

    Returns void | Promise<void>

set

  • set(name: string, data: any, origin: string, expiration?: number): void | Promise<void>
  • Sets the item to the cache. origin is used for cache invalidation and should reflect the change in data.


    Parameters

    • name: string
    • data: any
    • origin: string
    • optionalexpiration: number

    Returns void | Promise<void>