Name: ali-mc
Owner: ali-sdk
Description: Aliyun OCS(open cache storage) client. (Just a Memcache client)
Created: 2015-12-28 06:24:39.0
Updated: 2017-11-01 01:54:42.0
Pushed: 2016-11-11 14:30:22.0
Size: 57
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
AliCloudDB for Memcache client. A standard implemetation of memcached binary protocol, and is compatible with spymemcached-2.12.0.jar.
install ali-mc --save
Create a mc client instance.
Parameters:
Example:
t MemcacheClient = require('ali-mc');
t client = new MemcacheClient({
st: ${host},
rt: ${port},
ername: ${username},
ssword: ${password},
protocol: ${protocol}, // default is `binary`, also can use `text`
responseTimeout: 50,
logger: console,
If the client is ready for services, callback function will be called.
Otherwise all method will return The server is not available!
;
Get the item with specified key.
Parameters:
Return:
Example:
all with callback
et(${someKey}, function(err, value) {
(err) {
return console.log(err);
nsole(value);
all without callback
t co = require('co');
unction *() {
y {
let value = yield mc.get(${someKey});
console.log(value);
catch(err) {
console.log(err);
Set should store the data unconditionally if the item exists or not. Add MUST fail if the item already exist. Replace MUST fail if the item doesn't exist.
Parameters:
Return:
Delete the item with specified key.
Parameters:
Return:
Add or remove the specified amount to the requested counter.
Increment will cause the counter to wrap if it is up to the max value of 64 bit unsigned int.
Decrement will never result in a “negative value” (or cause the counter to “wrap”)
Parameters:
Return:
Example:
ncrement(${someKey}, function(err, value) { ... });
bove is equal to
ncrement(${someKey}, 1, function(err, value) { ... });
lso is equal to
ncrement(${someKey}, {
ep: 1,
unction(err, value) { ... });
Flush the items in the cache now or some time in the future as specified by the “expired” field.
Parameters:
Return:
Request the server version.
Parameters:
Return:
Append or prepend the specified value to the requested key.
Parameters:
Return:
Example:
ppends "!" to the "Hello" key
ppend('Hello', '!', function(err) { ... });
Change the item's expiration.
Parameters:
Return:
All the same with .touch()
except this it will return the value of the spcified key. Text protocol not support
Close the client, you should listen the 'close' event to confirm that the client closes.
Emitted when an error occurs.
Parameters:
Emitted when the client closes.
MIT License (MIT)
right (c) 2016 fool2fish <fool2fish@gmail.com> and other contributors
ission is hereby granted, free of charge, to any person obtaining
py of this software and associated documentation files (the "Software"),
eal in the Software without restriction, including without limitation
rights to use, copy, modify, merge, publish, distribute, sublicense,
or sell copies of the Software, and to permit persons to whom the
ware is furnished to do so, subject to the following conditions:
above copyright notice and this permission notice shall be included
ll copies or substantial portions of the Software.
SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
ESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
R LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
R DEALINGS IN THE SOFTWARE.