Skip to content

Cache, allow custom wrapper types other than java.util.Optional [SPR-16530] #21073

Closed as not planned

Description

@spring-projects-issues

Ken Schosinsky opened SPR-16530 and commented

Currently the caching annotations can only work with java.util.Optional. There's no support for other wrapper types (e.g. Vavr's Option/Try/Either/Lazy etc.).

I would like to be able to register custom return value unwrappers or something equivalent to the key property for the return value:

// Example with Vavr's Either
@CachePut(cacheNames = "myCache", condition = "#result.isRight()", result = "#result.getRight()")
Either<String, CacheData> myMethod(int id);

Greetings,
Ken


Issue Links:

Activity

  1. added
    type: enhancement
    in: core
    on Jan 11, 2019
  2. removed this from the 6.x Backlog milestone on Dec 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coretype: enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions