计数器操作

初始化一个view_count的KEY

bucket.insert('view_count', 0, function(err, result) {
   // console.log(result);
});

Increments 操作

bucket.counter("view_count", 1, function(err, result) {
    console.log(result.value);
});

console结果:

1

回返回Increments后的结果值

decrements 操作

bucket.counter("view_count", -1, function(err, result) {
    console.log(result.value);
});

Last updated

Was this helpful?