0.12.0 • Published 6 years ago

kt-client v0.12.0

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

kt-client

NPM version Build Status Coverage Status Dependency Status devDependency Status

KyotoTycoon client for Node.js

Installation

npm install kt-client

Setting up the client

const KyotoTycoon = require('kt-client');
const kt = new KyotoTycoon(options);

Options

  • host: String KyotoTycoon server
  • port: Number port number

API

kt.get(key, options, callback)

  • key: String the name of the key
  • options: Object options
  • callback: Function the callback
kt.get('foo', (error, value) => {
  console.log(value);
});

kt.set(key, value, options, callback)

  • key: String the name of the key
  • value: Mixed value
  • options: Object options
  • callback: Function the callback
kt.set('foo', 'bar', (error) => {
  console.log(error);
});

kt.add(key, value, options, callback)

  • key: String the name of the key
  • value: Mixed value
  • options: Object options
  • callback: Function the callback
kt.add('foo', 'bar', (error) => {
  console.log(error);
});

kt.replace(key, value, options, callback)

  • key: String the name of the key
  • value: Mixed value
  • options: Object options
  • callback: Function the callback
kt.replace('foo', 'bar', (error) => {
  console.log(error);
});

kt.remove(key, callback)

  • key: String the name of the key
  • callback: Function the callback
kt.remove('foo', (error) => {
  console.log(error);
});

kt.void(callback)

  • callback: Function the callback
kt.void((error) => {
  console.log(error);
});

kt.echo(callback)

  • params: Object arbitrary records
  • callback: Function the callback
kt.echo({foo: 'bar'}, (error, data) => {
  console.log(data.foo);  // => bar
});

kt.report(callback)

  • callback: Function the callback
kt.report((error, data) => {
  Object.keys(data).forEach((key) => {
    console.log(`key: ${key}, value: ${data[key]}`);
  });
});

kt.status(options, callback)

  • options: Object options
  • callback: Function the callback
kt.status((error, data) => {
  Object.keys(data).forEach((key) => {
    console.log(`key: ${key}, value: ${data[key]}`);
  });
});

kt.clear(options, callback)

  • options: Object options
  • callback: Function the callback
kt.clear((error) => {
  console.log(error);
});

kt.append(key, value, options, callback)

  • key: String the name of the key
  • value: Mixed value
  • options: Object options
  • callback: Function the callback
kt.append(key, value, (error) => {
  console.log(error);
});

kt.increment(key, num, options, callback)

  • key: String the name of the key
  • num: Number the additional number
  • options: Object options
  • callback: Function the callback
kt.increment(key, num, (error, num) => {
  console.log(num);
});

kt.incrementDouble(key, num, options, callback)

  • key: String the name of the key
  • num: Number the additional number
  • options: Object options
  • callback: Function the callback
kt.incrementDouble(key, num, (error, num) => {
  console.log(num);
});

kt.cas(key, oldValue, newValue, options, callback)

  • key: String the name of the key
  • oldValue: Mixed the old value
  • newValue: Mixed the new value
  • options: Object options
  • callback: Function the callback
kt.cas(key, oldValue, newValue, (error) => {
  console.log(err);
});

kt.check(key, options, callback)

  • key: String the name of the key
  • options: Object options
  • callback: Function the callback
kt.check(key, (error, size, expire) => {
  console.log(size);
  console.log(expire);
});

kt.seize(key, options, callback)

  • key: String the name of the key
  • options: Object options
  • callback: Function the callback
kt.seize(key, (error, value, expire) => {
  console.log(value);
  console.log(expire);
});

kt.setBulk(records, options, callback)

  • records: Object the records
  • options: Object options
  • callback: Function the callback
kt.setBulk(records, (error) => {
  console.log(error);
});

kt.removeBulk(records, options, callback)

  • keys: Array the key of the record
  • options: Object options
  • callback: Function the callback
kt.removeBulk(keys, (error) => {
  console.log(error);
});

kt.getBulk(records, options, callback)

  • keys: Array the key of the record
  • options: Object options
  • callback: Function the callback
kt.getBulk(keys, (error, ret) => {
  console.log(ret.key);
});

kt.vacuum(options, callback)

  • options: Object options
  • callback: Function the callback
kt.vacuum((error) => {
  console.log(error);
});

kt.matchPrefix(prefix, options, callback)

  • prefix: String the prefix string
  • options: Object options
  • callback: Function the callback
kt.matchPrefix('foo', (error, data) => {
  data.forEach((v) => {
    console.log(v);
  });
});

kt.matchRegex(regex, options, callback)

  • regex: String the regular expression string
  • options: Object options
  • callback: Function the callback
kt.matchRegex('foo.*', (error, data) => {
  data.forEach((v) => {
    console.log(v);
  });
});

kt.matchSimilar(origin, options, callback)

  • origin: String the origin string
  • options: Object options
  • callback: Function the callback
kt.matchSimilar('foo', (error, data) => {
  data.forEach((v) => {
    console.log(v);
  });
});

License

MIT

0.12.0

6 years ago

0.11.0

7 years ago

0.10.0

9 years ago

0.9.0

9 years ago

0.8.0

10 years ago

0.7.0

10 years ago

0.6.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago