7.0.2 • Published 3 years ago

@boredland/node-ts-cache-storage-memory v7.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

node-ts-cache-storage-memory

In-Memory storage module for node-ts-cache.

yarn add @boredland/node-ts-cache
yarn add @boredland/node-ts-cache-storage-memory
import { Cache, CacheContainer } from "@boredland/node-ts-cache"
import { MemoryStorage } from "@boredland/node-ts-cache-storage-memory"

const userCache = new CacheContainer(new MemoryStorage())

class MyService {
    @Cache(userCache, { ttl: 60 })
    public async getUsers(): Promise<string[]> {
        return ["Max", "User"]
    }
}