cache-manager-dotnet-like
TypeScript icon, indicating that this package has built-in type declarations

2.2.2 • Public • Published

cache-manager-dotnet-like

Aim

The package is giving solution for caching in frontend

Install

npm i cache-manager-dotnet-like

Usage

import { builder } from "cache-manager-dotnet-like"

  const manager = builder()
    //must be unique for diffrent managers will be identifing keys by that property
    .useNamespace("name")
    //specify storage type to use 
    .useLocalStorage()
    // specify default expiration of caache itema
    .useExpiration((exp) => exp.useSlidingExpiration(5 * 1000).build())
    // how often should cleaning function fire
    .usePeriodicalClean(1000)
    // subscribe to change of any item
    .useSubscribeToChange(console.log)
  .build();
  await manager.emitValuesAsync() // emit initial values found in local storage
  await manager.setItemAsync("blue", {nome:""})
  await manager.setItemAsync("white", {on: {}})

Dependents (0)

Package Sidebar

Install

npm i cache-manager-dotnet-like

Weekly Downloads

16

Version

2.2.2

License

MIT

Unpacked Size

29 kB

Total Files

72

Last publish

Collaborators

  • maciej-dot