import memory from 'https://deno.land/x/memory@v0.1.0/mod.ts'
const store = new memory({ maxAge: 60 * 1000 }) // a minute
store.set('a', 'example')
console.log(store.get('a')) // 'example'
console.log(store.has('a')) // true
// after a minute:
console.log(store.get('a')) // undefined
console.log(store.has('a')) // false
// a basic counter which is reset every minute:
console.log(store.increment('b')) // 0 <- automatically created
console.log(store.increment('b')) // 1
// update a item:
store.set('a', 'another example') // doesn't modify the age of the item
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
A simple module for caching data in memory for Deno.
License
boywithkeyboard/memory
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A simple module for caching data in memory for Deno.