-
Notifications
You must be signed in to change notification settings - Fork 43
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
expire parameter in @Memoize* methods should parseLong, not parseInt #5
Comments
Thanks, I agree that a Long is better for that situation. Most of my expires aren't more than a day out so I hadn't hit that issue. I look forward to the pull request if you've got time to do it. As a temporary fix, you could use the non-memoized version of the api (per my other e-mail to you) and get around that, I believe it uses a Long (and if it doesn't should also be fixed :). -Ted On Feb 29, 2012, at 1:40 PM, A.J. Brown wrote:
|
Actually upon further investigation, this isn't an issue. The issue is with the documentation, which states the expire time should be in miliseconds. In fact, it should be in seconds. @memoize( key="autocomplete:#{query}", expire='5184000' ) results in: "SETEX" "autocomplete:Dayto" "5184000" And according to the Redis docs, the second parameter is in seconds. Under the hood, Jedis excepts an int as the setex() parameter anyway, so the plugin should probably do the same. |
Didn't mean to close it since it should probably stay open until the documentation is updated :-) |
Thanks for digging in to it, I updated the docs to reflect that it's actually seconds, not milliseconds. -Ted On Feb 29, 2012, at 1:57 PM, A.J. Brown wrote:
|
It appears that the expire parameter is expected to be an Integer. Since the expire time is in milliseconds, it should be expected to be a Long in order to support bigger expire times.
This breaks (expire in 60 days):
@memoize( key="autocomplete:#{query}", expire='5184000000' )
with a NumberFormatException
This works fine
@memoize( key="autocomplete:#{query}", expire='5184000' )
It looks like the problem is in line 62 of MemoizeASTTransformation.groovy:
argumentListExpression.addExpression(makeConstantExpression(Integer.parseInt(memoizeProperties.get(EXPIRE).toString())))
I will attempt a fix and open a pull request.
The text was updated successfully, but these errors were encountered: