yield-cache
Cache utility for generator
plover \ node | 5.x | 4.x | 0.12.x |
---|---|---|---|
0.x.x | √ | √ | √ |
1.x.x | √ | √ | X |
$ npm install yield-cache
API
yieldCache()
create cache instance
var cache = yieldCache();
cache(key, obj)
try get item from cache or yeild from obj
cache.remove(key)
remove cache item for key
Useage
1. Create an instance for cache a group of generator
var cache = ;
2. Use cache instance
// it should used in generator function { // call with cackeKey and yieldable object var item = ;}
Example
var yieldCache = ; // create an instancevar renderCache = ; // use { var render = ; return render;} var path = ...var render = ;var render2 = ; rendershould;