Skip to content

CacheAspectSupport 's generateKey method should not concatenate Strings [SPR-12527] #17132

Closed
@spring-projects-issues

Description

@spring-projects-issues

Kyrill Alyoshin opened SPR-12527 and commented

CacheAspectSupport class has the following line of code at the beginning of its generateKey method:

Assert.notNull(key, "Null key returned for cache operation (maybe you are using named params " +
				"on classes without debug info?) " + context.operation);

YourKit shows that this single method call takes about 15% of total time when invoking a "cached" method through Spring caching pipeline. It is not surprising because context.operation object has a non-trivial implementation of the toString method.

We really think that this Assert.notNull call should be refactored into if(key == null)... for performance reasons.


Affects: 4.1.3

Referenced from: commits 67f1842

Backported to: 4.0.9

1 votes, 3 watchers

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions