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

Change cache key to account for key's modification time. #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smgoller
Copy link

@smgoller smgoller commented Oct 4, 2016

This change incorporates the key's last modification time in S3 into the local cache key. An alternative implementation would be to compare the last modification time to the time of the current request, but this seems more efficient.

@rhelmer
Copy link
Owner

rhelmer commented Oct 5, 2016

Thanks for the pull request! I took a quick look and looks reasonable to me, I will finish reviewing as soon as I can.


b = conn.get_bucket(bucket)
k = b.get_key(key)
if k == None:
Copy link
Owner

@rhelmer rhelmer Nov 3, 2016

Choose a reason for hiding this comment

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

if k is None:

if k == None:
return None
m.update(bucket+key+k.last_modified)
cache_key=m.hexdigest()
Copy link
Owner

Choose a reason for hiding this comment

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

space around =

b = conn.get_bucket(bucket)
k = b.get_key(key)
if k == None:
return None
Copy link
Owner

Choose a reason for hiding this comment

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

This should log.warn too.

k = b.get_key(key)
if k == None:
return None
m.update(bucket+key+k.last_modified)
Copy link
Owner

Choose a reason for hiding this comment

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

spaces around +

Copy link
Owner

@rhelmer rhelmer left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! I have a few minor requested changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants