Commit 603aa19c9b229e5710864512641304395ebbf379

Authored by Adhidarma Hadiwinoto
1 parent 471e3c0914
Exists in master

COUNTERS: hapus penggunaan subname

Showing 1 changed file with 10 additions and 10 deletions Side-by-side Diff

... ... @@ -5,25 +5,25 @@ const config = require('./config');
5 5  
6 6 const redisClient = redis.createClient(config.redis || { host: '127.0.0.1' });
7 7  
8   -function composeKeyword(name, subname) {
9   - return `CHONGLEE_MODEM_COUNTER_${name}_${subname || ''}`;
  8 +function composeKeyword(name) {
  9 + return `CHONGLEE_COUNTER_${name}}`;
10 10 }
11 11  
12   -exports.increment = (name, subname) => {
13   - redisClient.INCR(composeKeyword(name, subname));
  12 +exports.increment = (name) => {
  13 + redisClient.INCR(composeKeyword(name));
14 14 }
15 15  
16   -exports.reset = (name, subname) => {
17   - redisClient.DEL(composeKeyword(name, subname));
  16 +exports.reset = (name) => {
  17 + redisClient.DEL(composeKeyword(name));
18 18 }
19 19  
20   -exports.set = (name, subname, value) => {
21   - redisClient.SET(composeKeyword(name, subname), Number(value));
  20 +exports.set = (name, value) => {
  21 + redisClient.SET(composeKeyword(name), Number(value));
22 22 }
23 23  
24   -exports.get = (name, subname) => {
  24 +exports.get = (name) => {
25 25 return new Promise((resolve) => {
26   - redisClient.GET(composeKeyword(name, subname), (err, reply) => {
  26 + redisClient.GET(composeKeyword(name), (err, reply) => {
27 27 if (err) {
28 28 resolve(0);
29 29 return;