Skip to content

Latest commit

 

History

History
44 lines (36 loc) · 1.05 KB

custom-caching.md

File metadata and controls

44 lines (36 loc) · 1.05 KB

💾 Custom Caching / Storage

As the Mowojang library just uses the axios-cache-interceptor library internally you can also follow their docs on the two exported builders accessable via the cache export: buildMemoryStorage() and buildStorage()

Docs: https://axios-cache-interceptor.js.org/guide/storages

Custom Memory Storage

import { Client, cache } from "mowojang"

const Mowojang = new Client({
  cache: {
    storage: cache.buildMemoryStorage(
      false, // Doesn't clone data
      60 * 60 * 1000, // Cleans cache-leftovers every hour
      false // Doesn't set a max entry limit
      /**
       * More detailed documentation:
       *
       * https://axios-cache-interceptor.js.org/guide/storages#memory-storage
       */
    )
  }
})

Custom Storage

import { Client, cache } from "mowojang"

const Mowojang = new Client({
  cache: {
    storage: cache.buildStorage({
      /**
       * More detailed documentation:
       *
       * https://axios-cache-interceptor.js.org/guide/storages#buildstorage
       */
    })
  }
})