AJAX queue & cache
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
build
lib
test
.babelrc
.gitignore
Gruntfile.js
README.md
package.json

README.md

Queue Cache

Aims

  • Lightweight / Small
  • Framework agnostic / Raw JS
  • Overwriteable ajax success,error functions
  • Expire cache every Nth

Usage

The QueueCache class is a helper which combines the Queue & Cache class. You Can use the classes independantly if you desire for a custom implementation. The get method returns a Promise like Object. Which can handle the success and failure of the request.

var queuecache = new QueueCache()

queuecache.get('http://bingatron.local.ddau.biz:3031/api/public/pricing/models?make_id=1').then(function (res) {
  console.log('res', res)
}).catch(function (err) {
  console.log('err', err)
})
queuecache.get('http://bingatron.local.ddau.biz:3031/api/public/pricing/models?make_id=2')
queuecache.get('http://bingatron.local.ddau.biz:3031/api/public/pricing/models?make_id=3')

TODO:

  • Add priority to queue
  • Add cache clear expiry/TTL
  • Accept params in cache get
  • Extend Queue to handle the loading of images.