Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Redis for caching #3815

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

SamantazFox
Copy link
Member

Closes #3628

@SamantazFox SamantazFox force-pushed the move-caching-to-redis branch 2 times, most recently from 5b087ca to fe8ed6b Compare June 14, 2023 20:40
@github-actions
Copy link

This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.

@github-actions github-actions bot added the stale label Jul 30, 2023
@syeopite
Copy link
Member

What do you think about splitting the video cache into two? One for the streaming urls and the other for the metadata. We'd be able to persist the metadata for a lot longer than 6 hours then.

@SamantazFox
Copy link
Member Author

What do you think about splitting the video cache into two? One for the streaming urls and the other for the metadata. We'd be able to persist the metadata for a lot longer than 6 hours then.

That could be doable, I think. I guess you want the metadata to be used for imports or playlists?

@syeopite
Copy link
Member

syeopite commented Aug 29, 2023

I guess you want the metadata to be used for imports or playlists?

Yep. From what I can see Invidious also often calls #get_video to fetch video metadata only so splitting the cache can probably also save us quite a few calls to YouTube.

@SamantazFox
Copy link
Member Author

SamantazFox commented Oct 23, 2023

In the end, I think I'll go with that separation:

videos:<id>:title

  • Stores: the video title
  • Format: raw text
  • Retention: as long as possible (2 months?)

videos:<id>:release_date

  • Stores: the exact date at which the video was released
  • Format: ISO date
  • Retention: as long as possible (1 year?)
  • Updated from: watch page or channel RSS feed

videos:<id>:playback

  • Stores: the video's playback infos (captions/storyboards/streams)
  • Format: JSON
  • Retention: 5h, to keep the links fresh, except for livestreams where this is reduced to 1h.

videos:<id>:metadata

  • Stores: all the miscellaneous metadata for the watch page
  • Format: JSON
  • Retention: a few hours if the video was released recently, to keep views, likes and description fresh. After that, keep for a day or two.

@syeopite
Copy link
Member

Titles should probably just be included as a part of metadata imo. It's something that changes fairly frequently (especially when the video is new) and in some cases frequent title changes are the entire point of the video such as this one https://redirect.invidious.io/watch?v=BxV14h0kFs0

As for playback, you can probably split off storyboards from it. It's not something that should change often if at all.

@SamantazFox
Copy link
Member Author

Titles should probably just be included as a part of metadata imo. It's something that changes fairly frequently (especially when the video is new) and in some cases frequent title changes are the entire point of the video such as this one https://redirect.invidious.io/watch?v=BxV14h0kFs0

I know that titles may change (especially true when the video was recently released, to boost views). The main goal is to address #1356 and/or #3959 + #3035, which requires a long cache time.

As for playback, you can probably split off storyboards from it. It's not something that should change often if at all.

So you'd wand it with the metadata? Or separated? In all cases, all data will be refreshed whenever the video needs to be played.

@syeopite
Copy link
Member

So you'd wand it with the metadata? Or separated?

Either or is fine. I'm just not entirely sure why captions and storyboards are placed under videos:<id>:playback

Copy link

This pull request has been automatically marked as stale and will be closed in 30 days because it has not had recent activity and is much likely abandoned or outdated. If you think this pull request is still relevant and applicable, you just have to post a comment and it will be unmarked.

@github-actions github-actions bot added the stale label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] Moving the cache to Redis
2 participants