-
Notifications
You must be signed in to change notification settings - Fork 47
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
idea for time issues/features #62
Comments
Michael Bayer (zzzeek) wrote: The region.backend.get and region.backend.set methods give you the CachedValue object. You can write a new one that keeps the original creation time. |
jvanasco (jvanasco) wrote: This is weird, I see 3 responses in my email, but your detailed example isn't on bitbucket... Using the previous example of a Survey, my idea is that the conceptual object would be split into 2 K/V payloads:
They could be in a single region or multiple region. Either way, 2 keys would be needed for splitting up the data. If the backend's get/set methods allow for direct A detailed use-case would be something like this... i'll use the term "UPDATE" to describe the functionality of preserving the original creation time
I think this approach could handle the issues that @sontek brought up in #37 and #45 I got pinged with some bitbucket notices last week from those threads, and i foresee similar needs, so I've been thinking of ways to tackle the problem. [2015-11] Clarified the above example |
Michael Bayer (zzzeek) wrote: the detailed example is not here because I deleted it, it doesn't work :) you still need to be able to game the "created" timestamp in the cache. |
Michael Bayer (zzzeek) wrote: OK der I think what I had does work, very hard to get my head around these. If it is 12:30, and you updated the cache at 12:28, the "modulus" approach will have it such that the value will be invalidated. If OTOH the cache was updated at 12:31, and it is now 12:32, then the value will not be invalidated until 12:40 - but that is fine, right? Here's what it was:
the test I ran to show the motion was:
that is, at 18:10, nothing that is older than 18:10 can survive, even if the cache was just updated the previous minute. When i first read this issue this is what came to me in an insight and then as I was typing it out I lost it :). But I think this works? |
Migrated issue, originally created by jvanasco (jvanasco)
I came up with a use-case and idea that might tie together a few existing tickets.
It also might be a terrible idea.
Existing Tickets -
https://bitbucket.org/zzzeek/dogpile.cache/issue/37/expose-cache-age
https://bitbucket.org/zzzeek/dogpile.cache/issue/45/update-expiration-time-on-get
Use Case -
Given:
A) We have some "write" operations that are more frequent on some objects than others.
B) Our objects can be expensive to generate
C) We want to balance performance and clarity of code
Two options come to mind:
The first option can be less-readable
The second option has the caveat that writing will extend the cache expiry.
The general idea I have is this:
get_raw
returns a CacheHit object that has attributes forpayload
andtimestamp_expiry
. it possibly has an attribute fortimestamp_last_update
.CacheHit (or dogpile) has a method for
soft_update
-- which will set a modified payload without updating the expiry. alternatively, a new expiry time could happen as well.This would allow people to keep the original expiry time ( let's say 10 minutes ) but have the ability to "update" the value of the payload within that time. They payload would still expire in 10minutes ( unless explicitly extended ).
In the use-cases of comments and surveys, this might allow a developer to increment the 'count' of respondents many times over the span of a minute... yet still require a sync to the backend datastore every 10 minutes.
The text was updated successfully, but these errors were encountered: