0.0.3 • Published 6 years ago

controlled-list v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Build Status

  • promise supports
  • ttl support

install

npm i controlled-list --save

usage

const cl = require('controlled-list');

(async () => {
  const connector = await cl({
    client: {
      // redis configuration ..
    }
  });

  const list = connector('liiiist', {
    limit: 5,
    ttl: 10
  })

  console.log(await list.add(1)); // true
  console.log(await list.add(2)); // true
  console.log(await list.add(3)); // true
  console.log(await list.check()); // true
  console.log(await list.add(4)); // true
  console.log(await list.check()); // false
  console.log(await list.add(5)); // false

  console.log(await list.length()); // 4
  await list.clear()
  console.log(await list.length()); // 0
})();
  • add adds new element to list

  • length number of elements in the list

  • check checks the list limit. false if the limit is exceeded.

  • clear delete the list

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago