-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Cache improvements #142
Conversation
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Use
CACHE_AUTO
,CACHE_ONLY
andCACHE_PREVENT
for the cache variables.