-
Notifications
You must be signed in to change notification settings - Fork 253
Added support to set cache timeout in milliseconds #264
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
base: dev
Are you sure you want to change the base?
Conversation
…s using TimeSpan. Added new properties to CacheOutputAttribute to be able to specify timeouts by TimeSpan and used PreciseTime.
Thanks. The main problem is |
Sorry I did not realize that. I was trying to come up with something complex that would cover most of scenarios. What do you think about |
… cannot be passed as attribute property. Added client and server side tests.
I would still prefer to just have another set of properties that allow you to set milliseconds as ints. |
No problem, you are the boss here :-). There will be enough flexibility even with milliseconds. May I suggest |
yes that would make sense. I would make it nullable too. This way if you don't set it, the existing properties kick in automatically, and if you set the new milliseconds ones, they'd take precedence over the old ones (btw it's a bit unfortunate that the existing ones are not nullable too). We probably also need a comment on both the old properties and the new ones explaining this order of precedence. |
I think that nullable is not necessary. In my PR both old and new properties points to backing fields that are |
yes I get that but what if you set both? it should be deterministic |
Sorry I probably do not see your point here. How would nullable solve the undeterministic behavior when you set both secs and millis? |
if the new one is nullable you at least know that it was set or not set and can define behvioral rules based on that |
I see your point that if someone set both secs and millis it is not clear what should have precedence. But nullable does not solve it imho. Event when you make one of the properties nullable. You will still have to face the case that you have described
|
@filipw Is there anything I could do to move this PR forward? |
The problem in what you are proposing is that you have no way of knowing if the What I would like to see is as follows:
This is less ambiguous. |
…existing properties.
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.
thanks!
Thanks for cooperation. Glad to contribute. |
@filipw As you approved this PR would you please merge it and release new version of nuget? |
As described in #263 it is quite limiting to be able to set up cache timeout only in seconds. So that I have added new
TimeSpan
properties toCacheOutputAttribute
to set client, server and shared timeout. Also usage ofShortTime
was replaced by new implementation ofIModelQuery<DateTime, CacheTime>
calledPreciseTime
that takesTimeSpan
as constructor parameters.