Mongo cache (#6002)

* cache mongodb objects

remove user settings cache since it is cached at the object level

* removed indexOf from isMemberOfSets

* change has to get, change maxAge to 0
This commit is contained in:
Barış Soner Uşaklı
2017-10-23 18:31:16 -04:00
committed by GitHub
parent 7ad4420b6a
commit e7318a1cea
11 changed files with 178 additions and 160 deletions

View File

@@ -15,7 +15,7 @@ var LRU = require('lru-cache');
var cache = LRU({
max: 40000,
maxAge: 1000 * 60 * 60,
maxAge: 0,
});
module.exports = function (Groups) {
@@ -382,7 +382,7 @@ module.exports = function (Groups) {
}
var nonCachedUids = uids.filter(function (uid) {
return !cache.has(uid + ':' + groupName);
return !cache.get(uid + ':' + groupName);
});
if (!nonCachedUids.length) {
@@ -415,7 +415,7 @@ module.exports = function (Groups) {
}
var nonCachedGroups = groups.filter(function (groupName) {
return !cache.has(uid + ':' + groupName);
return !cache.get(uid + ':' + groupName);
});
if (!nonCachedGroups.length) {