diff options
author | Joram Wilander <jwawilander@gmail.com> | 2018-03-05 10:35:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 10:35:26 -0500 |
commit | 4a1802c039a0db2d97e8351c462963a99da857bf (patch) | |
tree | f083e9cd2c21434a6eba2dca7f90c127514bf727 /store/sqlstore/file_info_store.go | |
parent | fbff94f3be1bf596f2b94f593687d3b162413de9 (diff) | |
download | chat-4a1802c039a0db2d97e8351c462963a99da857bf.tar.gz chat-4a1802c039a0db2d97e8351c462963a99da857bf.tar.bz2 chat-4a1802c039a0db2d97e8351c462963a99da857bf.zip |
MM-9664 Add invalidation metrics for store caches (#8340)
* Add invalidation metrics for store caches
* Increment session invalidation metric
* Fix tests
Diffstat (limited to 'store/sqlstore/file_info_store.go')
-rw-r--r-- | store/sqlstore/file_info_store.go | 8 |
1 files changed, 7 insertions, 1 deletions
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 { |