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.
import { Memcached } from "@vef/deno-memcached";Note: The default host and port are
127.0.0.1and11211respectively.
const memcached = new MemcachedClient();const memcached = new MemcachedClient({
host: "some-host",
port: 1234,
});const memcached = new MemcachedClient({
path: "/path/to/socket",
});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, andpathoptions to the pool constructor.
await memcached.set("tableName", "key", "value");const value = await memcached.get("tableName", "key");await memcached.setJson("tableName", "key", { foo: "bar" });const value = await memcached.getJson("tableName", "key");await memcached.setList("listId", ["foo", "bar"]);const value = await memcached.getList("listId");