PLT-5308 Caching layer part 2 (#6973)
* Adding Reaction store cache layer example * Implementing reaction store in new caching system. * Redis for reaction store * Adding redis library * Adding invalidation for DeleteAllWithEmojiName and other minor enhancements
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6f4e38d129
Коммит
09b49c26dd
@@ -14,7 +14,6 @@ func RegisterAllClusterMessageHandlers() {
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_PUBLISH, ClusterPublishHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_UPDATE_STATUS, ClusterUpdateStatusHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_ALL_CACHES, ClusterInvalidateAllCachesHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS, ClusterInvalidateCacheForReactionsHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_WEBHOOK, ClusterInvalidateCacheForWebhookHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_POSTS, ClusterInvalidateCacheForChannelPostsHandler)
|
||||
einterfaces.GetClusterInterface().RegisterClusterMessageHandler(model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_CHANNEL_MEMBERS_NOTIFY_PROPS, ClusterInvalidateCacheForChannelMembersNotifyPropHandler)
|
||||
@@ -40,10 +39,6 @@ func ClusterInvalidateAllCachesHandler(msg *model.ClusterMessage) {
|
||||
InvalidateAllCachesSkipSend()
|
||||
}
|
||||
|
||||
func ClusterInvalidateCacheForReactionsHandler(msg *model.ClusterMessage) {
|
||||
InvalidateCacheForReactionsSkipClusterSend(msg.Data)
|
||||
}
|
||||
|
||||
func ClusterInvalidateCacheForWebhookHandler(msg *model.ClusterMessage) {
|
||||
InvalidateCacheForWebhookSkipClusterSend(msg.Data)
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ func SaveReactionForPost(reaction *model.Reaction) (*model.Reaction, *model.AppE
|
||||
|
||||
go sendReactionEvent(model.WEBSOCKET_EVENT_REACTION_ADDED, reaction, post)
|
||||
|
||||
InvalidateCacheForReactions(reaction.PostId)
|
||||
|
||||
return reaction, nil
|
||||
}
|
||||
}
|
||||
@@ -44,8 +42,6 @@ func DeleteReactionForPost(reaction *model.Reaction) *model.AppError {
|
||||
return result.Err
|
||||
} else {
|
||||
go sendReactionEvent(model.WEBSOCKET_EVENT_REACTION_REMOVED, reaction, post)
|
||||
|
||||
InvalidateCacheForReactions(reaction.PostId)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
@@ -314,23 +314,6 @@ func InvalidateWebConnSessionCacheForUser(userId string) {
|
||||
}
|
||||
}
|
||||
|
||||
func InvalidateCacheForReactions(postId string) {
|
||||
InvalidateCacheForReactionsSkipClusterSend(postId)
|
||||
|
||||
if einterfaces.GetClusterInterface() != nil {
|
||||
msg := &model.ClusterMessage{
|
||||
Event: model.CLUSTER_EVENT_INVALIDATE_CACHE_FOR_REACTIONS,
|
||||
SendType: model.CLUSTER_SEND_BEST_EFFORT,
|
||||
Data: postId,
|
||||
}
|
||||
einterfaces.GetClusterInterface().SendClusterMessage(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func InvalidateCacheForReactionsSkipClusterSend(postId string) {
|
||||
Srv.Store.Reaction().InvalidateCacheForPost(postId)
|
||||
}
|
||||
|
||||
func (h *Hub) Register(webConn *WebConn) {
|
||||
h.register <- webConn
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user