summaryrefslogtreecommitdiffstats
path: root/store/sqlstore/post_store.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-03-13 13:36:23 +0000
committerGeorge Goldberg <george@gberg.me>2018-03-13 13:36:23 +0000
commitfadcdd271a68b38571b75d1d38ab023f940ac83a (patch)
tree7f413edd35401b54b2f4eb4a687da1ac273bcd4b /store/sqlstore/post_store.go
parentb66e4bc932ed76c1cfd2b5f4ec0cfce70cd9fbb4 (diff)
parentf2d26801b9647715fb43af873354d8def753868b (diff)
downloadchat-fadcdd271a68b38571b75d1d38ab023f940ac83a.tar.gz
chat-fadcdd271a68b38571b75d1d38ab023f940ac83a.tar.bz2
chat-fadcdd271a68b38571b75d1d38ab023f940ac83a.zip
Merge branch 'master' into advanced-permissions-phase-1
Diffstat (limited to 'store/sqlstore/post_store.go')
-rw-r--r--store/sqlstore/post_store.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/store/sqlstore/post_store.go b/store/sqlstore/post_store.go
index 25c3c4913..92ee28ffa 100644
--- a/store/sqlstore/post_store.go
+++ b/store/sqlstore/post_store.go
@@ -35,9 +35,14 @@ const (
var lastPostTimeCache = utils.NewLru(LAST_POST_TIME_CACHE_SIZE)
var lastPostsCache = utils.NewLru(LAST_POSTS_CACHE_SIZE)
-func ClearPostCaches() {
+func (s SqlPostStore) ClearCaches() {
lastPostTimeCache.Purge()
lastPostsCache.Purge()
+
+ if s.metrics != nil {
+ s.metrics.IncrementMemCacheInvalidationCounter("Last Post Time - Purge")
+ s.metrics.IncrementMemCacheInvalidationCounter("Last Posts Cache - Purge")
+ }
}
func NewSqlPostStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.PostStore {
@@ -326,6 +331,11 @@ func (s SqlPostStore) InvalidateLastPostTimeCache(channelId string) {
// Keys are "{channelid}{limit}" and caching only occurs on limits of 30 and 60
lastPostsCache.Remove(channelId + "30")
lastPostsCache.Remove(channelId + "60")
+
+ if s.metrics != nil {
+ s.metrics.IncrementMemCacheInvalidationCounter("Last Post Time - Remove by Channel Id")
+ s.metrics.IncrementMemCacheInvalidationCounter("Last Posts Cache - Remove by Channel Id")
+ }
}
func (s SqlPostStore) GetEtag(channelId string, allowFromCache bool) store.StoreChannel {