Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/justin-m-lacy/archcache


https://github.com/justin-m-lacy/archcache

cache caching files javascript node

Last synced: 26 days ago
JSON representation

Awesome Lists containing this project

README

        

# Archcache

Simple In-Memory Cache with callbacks to save, load, and revive from a background store.

Caches can store subcaches to retrieve items in a hierarchical manner.

```
const cache = new Cache({

/// Base key prepended to items added to this cache.
/// cacheKeys of subcaches are concatenated and prefixed to an item's key.
cacheKey: '',
loader( cacheKey:string ){
/// Load item by key from backing store.
},
reviver( data:string ){
/// Revive data loaded from backing store.
},
saver( cacheKey:string, data:any ){
/// ... save data stored at key.
},
checker( cacheKey:string ){
/// Determine if keyed object exists in backing store.
},
deleter( cacheKey:string ){
/// Delete item from backing store
}

});

```