api-cacher
Most simple way to add caching in Promise based API in JavaScript
What is this ?
We normally query server data using XHR requests
, and we use Promises
for making XHR requests
!
This tiny library add caching layer for Promises
.
Example
{ User}
Above function will print users users !
But, What if your code will call this printUsers
method again and again ?
;;;//3 XHR Requests !
Solution is apiCacher library !
UserfindAllCached = ;{ User};;;//just 1 XHR Requests !
Bonus Examples
using cacheHash you can set cache key.
UserfindByIdCached = ;
License
MIT