pistache
v1.0.1
Published
in-memory cache with persistance as JSON / FileSystem storage
Downloads
2
Maintainers
Readme
const pistache = require('pistache')
// you pass it the directory name, and a list of index keys
// index keys must be unique, the first will be used as the primary key
const users = pistache('user', [ 'id', 'mail' ])
users.set({
id: 5,
firstname: 'jeano',
lastname: 'pernault',
mail: '[email protected]',
})
const userJeano = users.get(5)
const userJeanoFromMail = users.get.mail('[email protected]')
// write job is delayed in a save loop to allow user to freely spam
// the synchronous api without worrying about it affecting the performances
// All writes are atomics, the primary key is used as file name.