MM-56879: Migrate caches from store layer to cache layer (#26255)

There were 3 remaining caches which were there in the store layer.
We migrate them to make the store layer fully free
from any caches.

https://mattermost.atlassian.net/browse/MM-56879

```release-note
NONE
```

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Agniva De Sarker
2024-03-07 10:55:28 +05:30
коммит произвёл GitHub
родитель d7a77d8c42
Коммит 204c728b08
19 изменённых файлов: 325 добавлений и 275 удалений

Просмотреть файл

@@ -1791,7 +1791,7 @@ func TestHookPreferencesHaveChanged(t *testing.T) {
require.Nil(t, appErr)
assert.Equal(t, "test_value_third", preference.Value)
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
}
@@ -1854,11 +1854,12 @@ func TestChannelHasBeenCreated(t *testing.T) {
posts, appErr := th.App.GetPosts(channel.Id, 0, 1)
require.Nil(t, appErr)
assert.True(t, len(posts.Order) > 0)
post := posts.Posts[posts.Order[0]]
assert.Equal(t, channel.Id, post.ChannelId)
assert.Equal(t, "ChannelHasBeenCreated has been called for "+channel.Id, post.Message)
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
t.Run("should call hook when a DM is created", func(t *testing.T) {
@@ -1879,11 +1880,11 @@ func TestChannelHasBeenCreated(t *testing.T) {
posts, appErr := th.App.GetPosts(channel.Id, 0, 1)
require.Nil(t, appErr)
assert.True(t, len(posts.Order) > 0)
post := posts.Posts[posts.Order[0]]
assert.Equal(t, channel.Id, post.ChannelId)
assert.Equal(t, "ChannelHasBeenCreated has been called for "+channel.Id, post.Message)
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
t.Run("should call hook when a GM is created", func(t *testing.T) {
@@ -1905,11 +1906,11 @@ func TestChannelHasBeenCreated(t *testing.T) {
posts, appErr := th.App.GetPosts(channel.Id, 0, 1)
require.Nil(t, appErr)
assert.True(t, len(posts.Order) > 0)
post := posts.Posts[posts.Order[0]]
assert.Equal(t, channel.Id, post.ChannelId)
assert.Equal(t, "ChannelHasBeenCreated has been called for "+channel.Id, post.Message)
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
}
@@ -1987,9 +1988,9 @@ func TestUserHasJoinedChannel(t *testing.T) {
posts, appErr := th.App.GetPosts(channel.Id, 0, 1)
require.Nil(t, appErr)
assert.True(t, len(posts.Order) > 0)
assert.Equal(t, fmt.Sprintf("Test: User %s joined %s", user2.Id, channel.Id), posts.Posts[posts.Order[0]].Message)
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
t.Run("should call hook when a user is added to an existing channel", func(t *testing.T) {
@@ -2023,7 +2024,6 @@ func TestUserHasJoinedChannel(t *testing.T) {
// Typically, the post we're looking for will be the latest, but there's a race between the plugin and
// "User has joined the channel" post which means the plugin post may not the the latest one
posts, appErr := th.App.GetPosts(channel.Id, 0, 10)
require.Nil(t, appErr)
for _, postId := range posts.Order {
@@ -2035,7 +2035,7 @@ func TestUserHasJoinedChannel(t *testing.T) {
}
return false
}, 1*time.Second, 10*time.Millisecond)
}, 5*time.Second, 100*time.Millisecond)
})
t.Run("should not call hook when a regular channel is created", func(t *testing.T) {