Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno-memcached

A memcached client for Deno

Please note that this is a work in progress! There may be missing functionality and/or breaking changes from version to version.

Usage

import { Memcached } from "@vef/deno-memcached";

Note: The default host and port are 127.0.0.1 and 11211 respectively.

With a single connection

const memcached = new MemcachedClient();

With a custom host and port

const memcached = new MemcachedClient({
  host: "some-host",
  port: 1234,
});

Connect to a unix socket

const memcached = new MemcachedClient({
  path: "/path/to/socket",
});

With a connection pool

This will create a pool of connections to the memcached server, and handles assigning available connections to requests.

It will create a new connection if all connections are in used.

const memcached = new MemcachedPool({
  poolSize: 10, // default is 5
});

Note: You can also pass the host, port, and path options to the pool constructor.

Set a value

await memcached.set("tableName", "key", "value");

Get a value

const value = await memcached.get("tableName", "key");

Set a JSON value

await memcached.setJson("tableName", "key", { foo: "bar" });

Get a JSON value

const value = await memcached.getJson("tableName", "key");

Set a list value

await memcached.setList("listId", ["foo", "bar"]);

Get a list value

const value = await memcached.getList("listId");

About

A memcached client for Deno

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages