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

Cache improvements #142

Merged
merged 1 commit into from
Feb 22, 2020
Merged

Cache improvements #142

merged 1 commit into from
Feb 22, 2020

Conversation

michaelarnauts
Copy link
Collaborator

@michaelarnauts michaelarnauts commented Feb 22, 2020

Use CACHE_AUTO, CACHE_ONLY and CACHE_PREVENT for the cache variables.

  • CACHE_AUTO = 1 # Allow to use the cache, and query the API if no cache is available
  • CACHE_ONLY = 2 # Only use the cache, don't use the API
  • CACHE_PREVENT = 3 # Don't use the cache

@michaelarnauts michaelarnauts added the enhancement New feature or request label Feb 22, 2020
@codecov
Copy link

codecov bot commented Feb 22, 2020

Codecov Report

Merging #142 into master will increase coverage by 0.57%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #142      +/-   ##
==========================================
+ Coverage   80.21%   80.78%   +0.57%     
==========================================
  Files          23       23              
  Lines        2365     2389      +24     
==========================================
+ Hits         1897     1930      +33     
+ Misses        468      459       -9     
Impacted Files Coverage Δ
resources/lib/modules/menu.py 90.24% <0.00%> (-2.44%) ⬇️
resources/lib/vtmgo/vtmgo.py 78.77% <0.00%> (ø) ⬆️
resources/lib/plugin.py 91.66% <0.00%> (+0.21%) ⬆️
resources/lib/vtmgo/vtmgostream.py 82.82% <0.00%> (+2.02%) ⬆️
resources/lib/vtmgo/vtmgoauth.py 70.96% <0.00%> (+2.67%) ⬆️
resources/lib/modules/player.py 92.75% <0.00%> (+11.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa01980...f3559dd. Read the comment docs.

@michaelarnauts michaelarnauts merged commit c052dc8 into master Feb 22, 2020
@michaelarnauts michaelarnauts deleted the cache-improvements branch February 22, 2020 21:31
@@ -363,7 +367,7 @@ def get_swimlane(self, swimlane=None):
items = []
for item in result.get('teasers'):
if item.get('target', {}).get('type') == self.CONTENT_TYPE_MOVIE:
movie = self.get_movie(item.get('target', {}).get('id'), cache=True)
movie = self.get_movie(item.get('target', {}).get('id'), cache=CACHE_ONLY)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I assume CACHE_ONLY means that it does not update the cache when expired?
But still downloads if the cache is missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm, it seems it returns None if there is no cache.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

CACHE_ONLY is to use only the cache, and not make an API call.

This is used to give extra data when a big listing is requested and I don't want to delay the listing itself. Normally, everything should be already in the cache, but in the odd case it isn't (disabled by user, cache is still downloading), I don't want to have the user wait a few minutes for the listing to appear.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Cache doesn't expire at the moment IIRC, but when you open a program, I always download fresh data, and the cache is updated.

@dagwieers dagwieers added this to the v0.9.5 milestone Mar 3, 2020
@michaelarnauts michaelarnauts modified the milestones: v0.9.5, v1.0.0 Mar 5, 2020
This pull request was closed.
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.

2 participants