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 --- store/sqlstore/file_info_store.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'store/sqlstore/file_info_store.go') diff --git a/store/sqlstore/file_info_store.go b/store/sqlstore/file_info_store.go index 1d0767d1e..7559640c8 100644 --- a/store/sqlstore/file_info_store.go +++ b/store/sqlstore/file_info_store.go @@ -25,8 +25,11 @@ const ( var fileInfoCache *utils.Cache = utils.NewLru(FILE_INFO_CACHE_SIZE) -func ClearFileCaches() { +func (fs SqlFileInfoStore) ClearCaches() { fileInfoCache.Purge() + if fs.metrics != nil { + fs.metrics.IncrementMemCacheInvalidationCounter("File Info Cache - Purge") + } } func NewSqlFileInfoStore(sqlStore SqlStore, metrics einterfaces.MetricsInterface) store.FileInfoStore { @@ -118,6 +121,9 @@ func (fs SqlFileInfoStore) GetByPath(path string) store.StoreChannel { func (fs SqlFileInfoStore) InvalidateFileInfosForPostCache(postId string) { fileInfoCache.Remove(postId) + if fs.metrics != nil { + fs.metrics.IncrementMemCacheInvalidationCounter("File Info Cache - Remove by PostId") + } } func (fs SqlFileInfoStore) GetForPost(postId string, readFromMaster bool, allowFromCache bool) store.StoreChannel { -- cgit v1.2.3-1-g7c22