-
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
Allow prevention of caching "null" strings/objects #35
Comments
tednaleid
added a commit
that referenced
this issue
May 29, 2014
add `cacheNull: false` option to `memoizeObject`, fixes #35
I added this to the new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently, if I use the redisService.memoize() or @memoize annotation, it will store the result in redis even if the value is null. There are cases where I do not want to cache null values.
For example, if I'm using @MemoizeDomainObject on a find method like this:
I only want to cache this if a book is found. If not found (and null is returned), then I always want to look up the value again in case the book was added. I am actually more interested in the @MemoizeObject annotation, but it would apply to @MemoizeDomainObject as well.
I was thinking some kind of flag on the annotation.
For now when I want this behavior, I use the annotation(s) and then delete the redis key if null is returned. This is 3 redis calls (GET to check the key, SETEX to add null, then DEL to remove it) when I'd rather have 1 redis call (GET) in this case.
The text was updated successfully, but these errors were encountered: