MM-57193: Standardize the cache names (#26441)
We use the same name for hit/miss/invalidation metrics. The downside is that now we have conflated a full cache purge and a single cache key invalidation into a single label, but the advantage is that it's easier to monitor the usage of a single cache. And moreover, duplicating the same string across multiple places increases the chances of making a mistake. Centralizing the cache name only at instantiation simplifies the code. After this, we would be ready to use Redis. https://mattermost.atlassian.net/browse/MM-57193 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
53471c7e8c
Коммит
7679f51e3e
@@ -49,9 +49,9 @@ func (s LocalCachePostStore) ClearCaches() {
|
||||
s.PostStore.ClearCaches()
|
||||
|
||||
if s.rootStore.metrics != nil {
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter("Last Post Time - Purge")
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter("Last Posts Cache - Purge")
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter("Posts Usage Cache - Purge")
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter(s.rootStore.lastPostTimeCache.Name())
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter(s.rootStore.postLastPostsCache.Name())
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter(s.rootStore.postsUsageCache.Name())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,8 +65,8 @@ func (s LocalCachePostStore) InvalidateLastPostTimeCache(channelId string) {
|
||||
s.PostStore.InvalidateLastPostTimeCache(channelId)
|
||||
|
||||
if s.rootStore.metrics != nil {
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter("Last Post Time - Remove by Channel Id")
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter("Last Posts Cache - Remove by Channel Id")
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter(s.rootStore.lastPostTimeCache.Name())
|
||||
s.rootStore.metrics.IncrementMemCacheInvalidationCounter(s.rootStore.postLastPostsCache.Name())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user