cache group membership methods
groups.isMember groups.isMembers groups.isMemberOfGroups clear cache for user on group.join & group.leavev1.18.x
parent
599ac80f3d
commit
fac68d52f6
@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var cacheController = {};
|
||||
|
||||
cacheController.get = function(req, res, next) {
|
||||
var postCache = require('../../posts/cache');
|
||||
var groupCache = require('../../groups').cache;
|
||||
|
||||
var avgPostSize = 0;
|
||||
var percentFull = 0;
|
||||
if (postCache.itemCount > 0) {
|
||||
avgPostSize = parseInt((postCache.length / postCache.itemCount), 10);
|
||||
percentFull = ((postCache.length / postCache.max) * 100).toFixed(2);
|
||||
}
|
||||
|
||||
res.render('admin/advanced/cache', {
|
||||
postCache: {
|
||||
length: postCache.length,
|
||||
max: postCache.max,
|
||||
itemCount: postCache.itemCount,
|
||||
percentFull: percentFull,
|
||||
avgPostSize: avgPostSize,
|
||||
dump: req.query.debug ? postCache.dump() : undefined
|
||||
},
|
||||
groupCache: {
|
||||
length: groupCache.length,
|
||||
max: groupCache.max,
|
||||
itemCount: groupCache.itemCount,
|
||||
percentFull: ((groupCache.length / groupCache.max) * 100).toFixed(2),
|
||||
dump: req.query.debug ? groupCache.dump() : undefined
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = cacheController;
|
@ -1,26 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var postCacheController = {};
|
||||
|
||||
postCacheController.get = function(req, res, next) {
|
||||
var cache = require('../../posts/cache');
|
||||
var avgPostSize = 0;
|
||||
var percentFull = 0;
|
||||
if (cache.itemCount > 0) {
|
||||
avgPostSize = parseInt((cache.length / cache.itemCount), 10);
|
||||
percentFull = ((cache.length / cache.max) * 100).toFixed(2);
|
||||
}
|
||||
|
||||
res.render('admin/advanced/post-cache', {
|
||||
cache: {
|
||||
length: cache.length,
|
||||
max: cache.max,
|
||||
itemCount: cache.itemCount,
|
||||
percentFull: percentFull,
|
||||
avgPostSize: avgPostSize
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
module.exports = postCacheController;
|
@ -0,0 +1,46 @@
|
||||
|
||||
<div class="post-cache">
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="fa fa-calendar-o"></i> Post Cache</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<label>Posts in Cache</label><br/>
|
||||
<span>{postCache.itemCount}</span><br/>
|
||||
|
||||
<label>Average Post Size</label><br/>
|
||||
<span>{postCache.avgPostSize}</span><br/>
|
||||
|
||||
<label>Length / Max</label><br/>
|
||||
<span>{postCache.length} / {postCache.max}</span><br/>
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{postCache.percentFull}" aria-valuemin="0" aria-valuemax="100" style="width: {postCache.percentFull}%;">
|
||||
{postCache.percentFull}% Full
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="fa fa-calendar-o"></i> Group Cache</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<label>Users in Cache</label><br/>
|
||||
<span>{groupCache.itemCount}</span><br/>
|
||||
|
||||
<label>Length / Max</label><br/>
|
||||
<span>{groupCache.length} / {groupCache.max}</span><br/>
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{groupCache.percentFull}" aria-valuemin="0" aria-valuemax="100" style="width: {groupCache.percentFull}%;">
|
||||
{groupCache.percentFull}% Full
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -1,27 +0,0 @@
|
||||
|
||||
<div class="post-cache">
|
||||
<div class="col-lg-9">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading"><i class="fa fa-calendar-o"></i> Post Cache</div>
|
||||
<div class="panel-body" data-next="{next}">
|
||||
|
||||
<label>Posts in Cache</label><br/>
|
||||
<span>{cache.itemCount}</span><br/>
|
||||
|
||||
<label>Average Post Size</label><br/>
|
||||
<span>{cache.avgPostSize}</span><br/>
|
||||
|
||||
<label>Length / Max</label><br/>
|
||||
<span>{cache.length} / {cache.max}</span><br/>
|
||||
|
||||
<div class="progress">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{cache.percentFull}" aria-valuemin="0" aria-valuemax="100" style="width: {cache.percentFull}%;">
|
||||
{cache.percentFull}% Full
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
Loading…
Reference in New Issue