think-memcache
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

think-memcache

Build Status Coverage Status npm

Install

npm install think-memcache

How to Usage

default options

You can find all the config options at http://memcache-plus.com/

const defaultOptions = {
  hosts: ['127.0.0.1:11211'],
  maxValueSize: 1048576,
  netTimeout: 5000,
  reconnect: true
}

usage

import Memcache from '../index';

let memInst = new Memcache(config);

// set key, expire should be milliseconds
let s1 = await memInst.set('name2', 'lushijie'); // expire = 0
let s2 = await memInst.set('name3', 'lushijie', 3000); // milliseconds

// get key's value
let g1 = await memInst.get('name2');

// delete key
await memInst.delete(key);

// increase 1, key'value should be integer, if key not exist will do nothing
await memInst.increase(key);

// decrease 1, key'value should be integer, if key not exist will do nothing
await memInst.decrease(key);

Readme

Keywords

Package Sidebar

Install

npm i think-memcache

Weekly Downloads

1

Version

1.1.2

License

ISC

Unpacked Size

8.14 kB

Total Files

8

Last publish

Collaborators

  • lizheming
  • welefen
  • sijiecai
  • lushijie
  • berwin
  • bezos
  • toxicjohann
  • huangxiaolu