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

[DONE] Use cache to store video data #969

Merged
merged 5 commits into from
Oct 3, 2023

Conversation

ptitloup
Copy link
Contributor

@ptitloup ptitloup commented Oct 2, 2023

Before sending your pull request, make sure the following are done :

  • You have read our contribution guidelines.
  • Your PR targets the develop branch.
  • The title of your PR starts with [WIP] or [DONE].

@ptitloup ptitloup changed the base branch from master to develop October 2, 2023 14:00
@ptitloup ptitloup self-assigned this Oct 2, 2023
@ptitloup ptitloup added the enhancement New feature or request label Oct 2, 2023
@ptitloup
Copy link
Contributor Author

ptitloup commented Oct 2, 2023

Pour les infos/doc, je suis allé voir de ce côté : https://docs.djangoproject.com/fr/3.2/topics/cache/

Copy link
Contributor

@AymericJak AymericJak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je n'ai pas testé en local mais niveau code, c'est bon pour moi.
C'est une bonne idée d'utiliser les caches pour ça !

PS : dans la PR stats, j'ai retiré ça du context_processor pour le mettre dans un template tag.
J'adapterais aussi en conséquence pour utiliser les caches.

Merci pour ta PR.

Copy link
Collaborator

@Badatos Badatos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

une mini remarque mais c'est bon pour moi ;)

"""Function called to store video data in cache."""
cache.delete(['DISCIPLINES', 'VIDEOS_COUNT', 'VIDEOS_DURATION', 'TYPES'])
request = None
video_data = context_video_data(request)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'aurais mis directement "None" à la place de request vu qu'on ne le réutilise pas, mais sinon OK pour moi ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok , j'ai egalement fixé un petit bug qui ne supprimait pas les données puisqu'il fallait utiliser delete_many.

Copy link
Contributor

@SebastienCozeDev SebastienCozeDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour ma part, tout me semble bon au niveau du code. Je n'ai testé en local.

@ptitloup ptitloup merged commit 483ca6f into develop Oct 3, 2023
4 checks passed
vsabatie pushed a commit to vsabatie/Pod that referenced this pull request Nov 22, 2023
* Use cache to store video data - get it in context - create command to store video data

* change name of video context processor

* add some pydoc

* update cache timeout to 600 seconds - use DRY and call context cache video data instead of repeat code

* use delete many to clear cache
@ptitloup ptitloup deleted the ptitloup/use_cache_to_store_video_data branch April 8, 2024 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants