npm.io
4.4.0 • Published 4 years ago

node-ts-cache-storage-memory

Licence
MIT
Version
4.4.0
Deps
2
Size
7 kB
Vulns
0
Weekly
0
Stars
50

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

npm i node-ts-cache
npm i node-ts-cache-storage-memory
import { Cache, CacheContainer } from "node-ts-cache"
import { MemoryStorage } from "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"]
    }
}

Keywords