question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Option to store null values into the local cache

See original GitHub issue

Is your feature request related to a problem? Please describe.

I have an application that is using Hazelcast “near cache” extensively and I’m evaluating a migration to Redis using Redisson “local cache” because I would like to use the AWS ElastiCache Redis service. This application does thousands of cache reads for every user request, so the “local cache” is really needed.

For testing purposes, I launched the same request twice to this application using Hazelcast and twice using Redis, and I saw that the second execution time for the Redis application was higher than the second execution time for the Hazelcast application. It was very surprising considering that the second request should read the data from the “local cache” (redisson).

I debugged the application code and I found that it does hundreds of cache misses. On the othe hand, I found that Redisson only updates the local cache when reading the map value from redis gives a not null value. This redisson code is in RedissonLocalCachedMap.getAsync():

future.onComplete((value, e) -> {
    (...)
    if (value != null) {
        cachePut(cacheKey, key, value);
    }
});

So, considering that our application does hundreds of cache misses and that Redisson local cache always tries to read the value from redis (even when it tried to read the same key before), it is reasonable that our application performs worse than expected.

Describe the solution you’d like

In order to improve our application performance when using Redis I think that it would be helpful to be able to add null values to the Redisson local cache, maybe adding an extra option in LocalCachedMapOptions; something like cacheNullValues, with a false value by default. I think that something related was fixed in #928 and #853

Describe alternatives you’ve considered

I have not considered an alternative 😞

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:13
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mrnikocommented, Dec 11, 2020

Yeah. Please add allowNullValues setting to LocalCachedMapOptions object.

0reactions
mrnikocommented, Dec 28, 2020

@theigl

I created separate issue for this task https://github.com/redisson/redisson/issues/3313

Read more comments on GitHub >

github_iconTop Results From Across the Web

Optimize NULL values storage consumption using SQL Server ...
Sparse Column is a very efficient feature that can be used to store NULL values in a database table with a high NULL...
Read more >
Null value lingers in cache after Cache.Remove(key)
I added a caching layer between my ASP.
Read more >
Null Values - Informatica Documentation
Insert null values. The Integration Service uses null values from the source and updates the lookup cache and target table using all values...
Read more >
Reading and writing data to the cache - Apollo GraphQL Docs
If the cache is missing data for any of the query's fields, readQuery returns null . It does not attempt to fetch data...
Read more >
How to Avoid Returning Null from a Method - Coding Helmet
This cache keeps data indexed by keys, which are strings. The Store method can be used to associate a value with a desired...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found