From 4a1802c039a0db2d97e8351c462963a99da857bf Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 5 Mar 2018 10:35:26 -0500 Subject: MM-9664 Add invalidation metrics for store caches (#8340) * Add invalidation metrics for store caches * Increment session invalidation metric * Fix tests --- app/admin.go | 10 +++++----- app/session.go | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'app') diff --git a/app/admin.go b/app/admin.go index 154fa8899..22928390e 100644 --- a/app/admin.go +++ b/app/admin.go @@ -15,7 +15,6 @@ import ( l4g "github.com/alecthomas/log4go" "github.com/mattermost/mattermost-server/model" - "github.com/mattermost/mattermost-server/store/sqlstore" "github.com/mattermost/mattermost-server/utils" ) @@ -141,10 +140,11 @@ func (a *App) InvalidateAllCachesSkipSend() { l4g.Info(utils.T("api.context.invalidate_all_caches")) a.sessionCache.Purge() ClearStatusCache() - sqlstore.ClearChannelCaches() - sqlstore.ClearUserCaches() - sqlstore.ClearPostCaches() - sqlstore.ClearWebhookCaches() + a.Srv.Store.Channel().ClearCaches() + a.Srv.Store.User().ClearCaches() + a.Srv.Store.Post().ClearCaches() + a.Srv.Store.FileInfo().ClearCaches() + a.Srv.Store.Webhook().ClearCaches() a.LoadLicense() } diff --git a/app/session.go b/app/session.go index 459618439..88f52477f 100644 --- a/app/session.go +++ b/app/session.go @@ -138,6 +138,9 @@ func (a *App) ClearSessionCacheForUserSkipClusterSend(userId string) { session := ts.(*model.Session) if session.UserId == userId { a.sessionCache.Remove(key) + if a.Metrics != nil { + a.Metrics.IncrementMemCacheInvalidationCounterSession() + } } } } -- cgit v1.2.3-1-g7c22