2016-07-22 23:05:01 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var redisConfig = {
|
|
|
|
host: global.settings.redis_host,
|
|
|
|
port: global.settings.redis_port,
|
|
|
|
max: global.settings.redisPool,
|
|
|
|
idleTimeoutMillis: global.settings.redisIdleTimeoutMillis,
|
|
|
|
reapIntervalMillis: global.settings.redisReapIntervalMillis
|
|
|
|
};
|
|
|
|
var metadataBackend = require('cartodb-redis')(redisConfig);
|
|
|
|
|
|
|
|
module.exports.clean = function clean(pattern, callback) {
|
|
|
|
metadataBackend.redisCmd(5, 'KEYS', [ pattern ], function (err, keys) {
|
|
|
|
if (err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
metadataBackend.redisCmd(5, 'DEL', keys, callback);
|
|
|
|
});
|
|
|
|
};
|
2016-08-01 17:48:11 +08:00
|
|
|
|
|
|
|
module.exports.getConfig = function getConfig() {
|
|
|
|
return redisConfig;
|
|
|
|
};
|