Skip to content

Cache KeyGenerator.extract() should allow to use the bean identity [SPR-7971] #12626

@spring-projects-issues

Description

@spring-projects-issues

Sylvain LAURENT opened SPR-7971 and commented

The new org.springframework.cache.KeyGenerator<K> interface introduced with 3.1M1 does not allow to generate a key that would take the identity of the bean into account.

Imagine that a method of a service is annotated with @Cacheable and I deploy 2 instances of the service each with its own configuration. There is no way I can provide a KeyGenerator implementation that generates 2 different keys for the same arguments passed to the 2 different instances of the service.

The signature of the extract method should be augmented with a String that is the id of the target Spring bean in its beanFactory.


Affects: 3.1 M1

Referenced from: commits 5c3ceb8

1 votes, 1 watchers

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions