...
|
...
|
@@ -9,6 +9,8 @@ |
|
|
const zookeeper = require('node-zookeeper-client');
|
|
|
const _ = require('lodash');
|
|
|
|
|
|
const ONE_YEAR = 60 * 60 * 24 * 365;
|
|
|
|
|
|
const getter = (client, path, memory, cache) => {
|
|
|
client.getData(
|
|
|
path,
|
...
|
...
|
@@ -26,7 +28,7 @@ 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'));
|
|
|
cache.set('zookeeper:' + path, data.toString('utf8'), ONE_YEAR);
|
|
|
console.log('cache %s data: %s', 'zookeeper:' + path, data.toString('utf8'));
|
|
|
} catch (e) {
|
|
|
}
|
...
|
...
|
|