memcached-client
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

node-memcached-client

Test npm GitHub release (latest by date) npm NPM

A Memcached client library for node.js. This library written in typescript and define promisified methods.

Install

$ npm install memcached-client

or

$ yarn add memcached-client

Usage

import Memcached, { Metadata } from 'memcached-client'

// Connect to your memcached server.
const client = new Memcached('127.0.0.1', 11211)

const example = async (client: Memcached) => {
  const connection = await client.connect()
  const code = await connection.set('my-key', 'my-value', false, 0)
  console.log(code) // => STORED
  const data: { [key: string]: Metadata } = await connection.get('my-key')
  if (data['my-key']) {
    console.log(data['my-key'].value) // => my-value
  }
  await connection.close()
}

And I prepared some examples.

Roadmap

This library does not yet cover all memcached methods. But I will implement all methods.

memcached-client version v0.1.x
get
set
delete
gets not yet
cas not yet
replace not yet
append not yet
prepend not yet
incr/decr not yet

License

The software is available as open source under the terms of the MIT License.

/memcached-client/

    Package Sidebar

    Install

    npm i memcached-client

    Weekly Downloads

    43

    Version

    0.2.2

    License

    MIT

    Unpacked Size

    36.1 kB

    Total Files

    22

    Last publish

    Collaborators

    • h3poteto