functional

This commit is contained in:
2022-05-26 19:59:18 -05:00
parent 4c97aa1f88
commit be1750944c
9 changed files with 614 additions and 451 deletions

31
examples/basic.ts Normal file
View File

@@ -0,0 +1,31 @@
import { setFlag, globalStorage, initGlobalCache } from '..'
function modifyStorage() {
let storage = globalStorage()
storage.set({
a: 'aaaaa',
b: 'bbbbb',
c: 'ccccc',
})
}
function main() {
//change the storage directory
setFlag('dir', './data')
//initialize global cache with data
initGlobalCache({
a: 'aaa',
b: 'bbb',
})
//get an instance of the global cache
let storage = globalStorage()
console.log(storage.get())
//modify another instance of the global cache
modifyStorage()
console.log(storage.get())
}
main()