...
|
...
|
@@ -9,7 +9,7 @@ |
|
|
const zookeeper = require('node-zookeeper-client');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const ONE_YEAR = 60 * 60 * 24 * 365;
|
|
|
const ONE_MONTH = 60 * 60 * 24 * 30;
|
|
|
|
|
|
const getter = (client, path, memory, cache) => {
|
|
|
client.getData(
|
...
|
...
|
@@ -27,11 +27,8 @@ const getter = (client, path, memory, cache) => { |
|
|
|
|
|
memory && _.set(memory, keys, data.toString('utf8') === 'true' ? true : false);
|
|
|
if (cache) {
|
|
|
try {
|
|
|
cache.set('zookeeper:' + path, data.toString('utf8'), ONE_YEAR);
|
|
|
console.log('cache %s data: %s', 'zookeeper:' + path, data.toString('utf8'));
|
|
|
} catch (e) {
|
|
|
}
|
|
|
cache.set('zookeeper:' + path, data.toString('utf8'), ONE_MONTH).catch(console.error);
|
|
|
console.log('cache %s data: %s', 'zookeeper:' + path, data.toString('utf8'));
|
|
|
}
|
|
|
console.log('%s data: %s', path, data.toString('utf8'));
|
|
|
}
|
...
|
...
|
|