MM-59933: Increment/Decrement the member count directly (#28196)
While using Redis, there is no need to invalidate and then update the new count from the DB when we know the exact number it is going to be incremented or decremented by. In that case, we can directly use Redis primitives to update the cache and prevent yet another DB query. To achieve this, we modify the LRU cache get/set paths slightly to not marshal into byte slices for *int64 values. This is needed for Redis to operate the INCR/DECR commands. https://mattermost.atlassian.net/browse/MM-59933 ```release-note NONE ``` Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
da24e0c4da
Коммит
7be7a47fd3
14
server/platform/services/cache/cache.go
поставляемый
14
server/platform/services/cache/cache.go
поставляемый
@@ -52,3 +52,17 @@ type Cache interface {
|
||||
// Name returns the name of the cache
|
||||
Name() string
|
||||
}
|
||||
|
||||
// ExternalCache is a super-set of the Cache interface with
|
||||
// a couple of more methods that allows for more efficient cache updates.
|
||||
// This can be achieved because the cache is external and an update
|
||||
// is visible to all nodes.
|
||||
type ExternalCache interface {
|
||||
Cache
|
||||
// Increment will increment the
|
||||
// number stored at that key by the value.
|
||||
Increment(key string, val int) error
|
||||
// Decrement will decrement the
|
||||
// number stored at that key by the value.
|
||||
Decrement(key string, val int) error
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user