lscache icon indicating copy to clipboard operation
lscache copied to clipboard

No resetBucket() method listed in the README

Open impressivewebs opened this issue 10 years ago • 4 comments

I notice that there is a resetBucket() method, but the README doesn't discuss it. Can this be added? On a related note, the README says the API exposes 5 methods, but it's actually 7 if you include the two bucket methods.

impressivewebs avatar Jun 23 '15 07:06 impressivewebs

Sure, can you send a pull request? I don't actually use lscache in any of my projects these days, so I haven't had an excuse to actively work on it. Thus, I love pull requests like that! :)

pamelafox avatar Jul 25 '15 23:07 pamelafox

Ok, I'll see what I can do. Thanks.

impressivewebs avatar Jul 26 '15 02:07 impressivewebs

A question, according to your note,

lscache.set('response', '...', 2);
lscache.setBucket('lib');
lscache.set('path', '...', 2);
lscache.flush();

then is everything after setBucket using 'lib'?

martianmartian avatar Sep 28 '15 23:09 martianmartian

also, in your example

function initBuckets() {
  var bucket1 = [];
  for (var i = 0; i < CARDS_DATA.length; i++) {
    var datum = CARDS_DATA[i];
    bucket1.push({'id': datum.id, 'lastAsked': 0});
  }
  lscache.set(LS_BUCKET + 1, bucket1);
  lscache.set(LS_BUCKET + 2, []);
  lscache.set(LS_BUCKET + 3, []);
  lscache.set(LS_BUCKET + 4, []);
  lscache.set(LS_BUCKET + 5, []);
  lscache.set(LS_INIT, 'true')
}

is it good practice or unnecessary to use lscache.setBucket("something") ?

martianmartian avatar Sep 28 '15 23:09 martianmartian