jprichardson / node-jsonfile

Easily read/write JSON files.
MIT License
1.2k stars 321 forks source link

Add simple caching functionallity #20

Closed tkhduracell closed 9 years ago

tkhduracell commented 9 years ago

How about adding a simple caching mechanism?

var json = js.readFileSync('/path', {expire: 3600} );
jprichardson commented 9 years ago

What would it mean to expire? The object would be set to null after expiration?

tkhduracell commented 9 years ago

Yes, essentially. The file would be read from filesystem again, when js.readFileSync is called. Could be handy in my view. Maybe it is out of the scope of this project though.

jprichardson commented 9 years ago

Yeah, I think this is out of scope. This could easily be done in a library that builds upon json-file.