360degrees / mcd Goto Github PK
View Code? Open in Web Editor NEWThis project forked from echoteam/mcd
Fast memcached protocol client in pure Erlang
License: BSD 2-Clause "Simplified" License
This project forked from echoteam/mcd
Fast memcached protocol client in pure Erlang
License: BSD 2-Clause "Simplified" License
Erlang memcached client library. This library provides two ways of working with memcached servers. One way is to use a single server, as described in #1. Another way is to use a number of memcached servers in a consistent hashing mode. This is described in #2. 1. RUNNING IN SINGLE-SERVER MODE 1.1 Starting a single memcached The following will start the anonymous mcd client, addressable by the returned pid(). mcd:start_link(["localhost", 11211]). The next one will connect to the memcached server on the local host, and will also register the mcd instance under the 'myMcd' name. See 3. The mcd API can use the returned pid() and the registered name interchangeably. mcd:start_link(myMcd, []). mcd:set(myMcd, a, b). mcd:get(myMcd, a). The 'localmcd' name is a special convention, allowing mcd API to be used without the explicit mcd process specification. unlink(element(2, mcd:start_link(localmcd, []))). mcd:set(a, b). mcd:get(a). 1.2 A ChildSpec for running the mcd named 'localmcd' under a supervisor { localmcd, { mcd, start_link, [localmcd, ["localhost", 11211] ] }, permanent, 10000, worker, [mcd] } 2. RUNNING IN CLUSTERED MODE mcd_starter starts a set of of memcached instances and mcd_cluster dispatcher attached to them. All memcached instances and mcd_cluster are linked to this gen_server, so a proper exit hierarchy is formed. 2.1 Starting memcached cluster from the command line (e.g., for testing) mcd_starter:start_link(mainCluster, [ ["remoteHost1", 11211], ["remoteHost2", 1890] ]). 2.2 A ChildSpec for running the cluster named 'mainCluster' under a supervisor { mainCluster, { mcd_starter, start_link, [mainCluster, [ ["remoteHost1"], ["remoteHost2", 1890] ] }, permanent, infinity, supervisor, [mcd_starter] } Note: the default port for "remoteHost1" is 11211. 3. USING MEMCACHED {ok, b} = mcd:set(localmcd, a, b). {error, notfound} = mcd:get(localmcd, foo). {ok, [42]} = mcd:set(mainCluster, <<"bar">>, [42]). {ok, [42]} = mcd:get(mainCluster, <<"bar">>). By convention, you can omit specifying 'localmcd' (see 1.2): {ok, alive} = mcd:set(self(), alive). {ok, alive} = mcd:get(self()).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.