mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 10:46:14 +01:00
Allow running as a cluster without Redis (#6233)
* [database/*] Allow databases other than Redis to provide pubsub for clustering if Redis is not present * [pubsub] Delay messages sent before the database is ready until the database is ready. * [pubsub] Restore old behavior of not using the database in non-clustered NodeBB instances. See comment: https://github.com/NodeBB/NodeBB/pull/6233#issuecomment-357814968
This commit is contained in:
committed by
Barış Soner Uşaklı
parent
c20aca8933
commit
e85aabbe74
@@ -5,7 +5,6 @@ module.exports = function (db, module) {
|
||||
|
||||
var LRU = require('lru-cache');
|
||||
var _ = require('lodash');
|
||||
var pubsub = require('../../pubsub');
|
||||
|
||||
var cache = LRU({
|
||||
max: 10000,
|
||||
@@ -17,24 +16,6 @@ module.exports = function (db, module) {
|
||||
cache.hits = 0;
|
||||
module.objectCache = cache;
|
||||
|
||||
pubsub.on('mongo:hash:cache:del', function (key) {
|
||||
cache.del(key);
|
||||
});
|
||||
|
||||
pubsub.on('mongo:hash:cache:reset', function () {
|
||||
cache.reset();
|
||||
});
|
||||
|
||||
module.delObjectCache = function (key) {
|
||||
pubsub.publish('mongo:hash:cache:del', key);
|
||||
cache.del(key);
|
||||
};
|
||||
|
||||
module.resetObjectCache = function () {
|
||||
pubsub.publish('mongo:hash:cache:reset');
|
||||
cache.reset();
|
||||
};
|
||||
|
||||
module.setObject = function (key, data, callback) {
|
||||
callback = callback || helpers.noop;
|
||||
if (!key || !data) {
|
||||
|
||||
Reference in New Issue
Block a user