Skip to content

Null-values are not cacheable #6

@ydewit

Description

@ydewit

We have a service that returns null as a value, but it seems that EnhancedTransactionAwareCacheDecorator is treating that explicitly set as deleted in the code below:

    public ValueWrapper get(@NonNull final Object key)
    {
        final TransientCacheData tcd = tcd();
        final ValueWrapper res = tcd.getTransientCache().get(key);
        if (res != null && isNull(res))
        {
            // Was explicitly set as deleted
            return null;
        }

Returning Optional instead will also not work since Spring Cache unwraps it.

The end result is that we are seeing repeated calls to the underlying storage.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions