0.0.11 • Published 8 years ago

sb-smart-cache v0.0.11

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

Smart-Cache

Smart-Cache is a tiny nodejs fs caching module that fits everywhere, It supports custom validate and fetch functions so You can use it for network mounts or efficient network downloads in your apps.

My personal use case was that I was working on a nodejs assets server that automatically transpiles the contents, and for that I needed and efficient yet strong and reliable cache, Tara! Smart-Cache was born.

API

class SmartCache<TVal, TCompare>{
  constructor(?LRUOptions, ?cacheValidator<TCompare>, ?cacheFetcher<TVal>)
  get(filePath):Promise<TVal>
  dispose():void
  static DefaultValidator<TCompare>(filePath, oldValue):Promise<TCompare>
  static DefaultFetcher<TVal>(filePath):Promise<TVal>
}

Example

const SmartCache = require('smart-cache')
const smartCache = new SmartCache
smartCache.get("/etc/passwd").then(function(contents){
  console.log(contents)
})

License

This project is licensed under the terms of MIT License. See the LICENSE file for more info.

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago