#52 [RFC] Caching streams using Redis

Открыто
5 лет назад открыта biodantas · комментариев: 3
biodantas прокомментировал 5 лет назад

Like Chimo pointed out in an issue in their Redis plugin for GNU social (now integrated), seen here it should be possible to cache notice streams. To this effect, it's necessary to

figure out which :user/all streams to invalidate when new notices are added/deleted. A good starting point might be to get every local user who is subscribed to the author of the inserted/deleted notice, and invalidate their :user/all streams.

I don't have much experience with this type of thing and would appreciate some insight on the best way to do it.

Like Chimo pointed out in an issue in their Redis plugin for GNU social (now integrated), seen [here](https://github.com/chimo/gs-rediscache/issues/2) it should be possible to cache notice streams. To this effect, it's necessary to > figure out which `:user/all` streams to invalidate when new notices are added/deleted. A good starting point might be to get every local user who is subscribed to the author of the inserted/deleted notice, and invalidate their `:user/all` streams. I don't have much experience with this type of thing and would appreciate some insight on the best way to do it.
Diogo Cordeiro прокомментировал 5 лет назад
Владелец

I'm not sure about why just local users... But, if only local users are relevant, there are events like onNoticeDistribute that you can catch for handling the proposed logic...

I'm not sure about why just local users... But, if only local users are relevant, there are events like onNoticeDistribute that you can catch for handling the proposed logic...
biodantas прокомментировал 5 лет назад
Автор

I don't think what Chimo meant was that only local users are relevant. I think it was just that they weren't entirely sure how it should be handled. But I agree that we could simply invalidate the caches of all users who follow the author.

I don't think what Chimo meant was that only local users are relevant. I think it was just that they weren't entirely sure how it should be handled. But I agree that we could simply invalidate the caches of all users who follow the author.
Diogo Cordeiro прокомментировал 5 лет назад
Владелец

Ah, sorry, I had misread.

@local_user posts

@another_local_user is subscribed to @local_user thus his notice stream is invalidated

@remote_user posts

@local_user is subscribed to @remote_user thus his notice stream is invalidated


So, essentially, you need the attention profiles for every saved notice.

I guess you will want the StartNoticeSave event and the getAttentionProfiles() method.

Ah, sorry, I had misread. @local_user posts @another_local_user is subscribed to @local_user thus his notice stream is invalidated @remote_user posts @local_user is subscribed to @remote_user thus his notice stream is invalidated --- So, essentially, you need the attention profiles for every saved notice. I guess you will want the [StartNoticeSave](https://notabug.org/diogo/gnu-social/src/nightly/classes/Notice.php#L708) event and the [getAttentionProfiles()](https://notabug.org/diogo/gnu-social/src/nightly/classes/Notice.php#L1868) method.
Войдите, чтобы присоединиться к обсуждению.
Нет этапа
Нет ответственного
2 участников
Загрузка...
Отмена
Сохранить
Пока нет содержимого.