mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-16 02:36:16 +01:00
possible fix for pubsub
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var pubsub = require('../../pubsub');
|
||||
|
||||
module.exports = function (db, module) {
|
||||
var helpers = module.helpers.mongo;
|
||||
|
||||
@@ -16,6 +18,25 @@ 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