ismorodin / ehcache-spring-annotations

Automatically exported from code.google.com/p/ehcache-spring-annotations
0 stars 0 forks source link

The ability to generate a key based on only partial method arguments #35

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
New feature request.

The way all the current built in key generator works is to take all method 
arguments into account. However, often, it's not the case.

For example, I have a function following takes that many parameters, however, 
my cache key is really only relied on the first two parameters.

public ProtocolFile addProtocolFileVersion(
            long protocolId,
            long parentProtocolFileId,
            long userId,
            long uploadedFileId,
            String category,
            String title);

It would be great, if I can mark each method parameter to say whether it's 
gonna participate in the key generator or not. Something like this,

public ProtocolFile addProtocolFileVersion(
            @PartialCacheKey long protocolId,
            @PartialCacheKey long parentProtocolFileId,
            long userId,
            long uploadedFileId,
            String category,
            String title);

Otherwise, the way I am doing is to have a specific key generator for each 
different possible combinations...

Thanks!

Jiang

Original issue reported on code.google.com by timobj@gmail.com on 29 Jun 2010 at 12:20

GoogleCodeExporter commented 9 years ago
Huh, that's a great idea. I'll add it to the list of things to work on for our 
next release.

Also we are more than happy to accept patches so on the off chance your 
comfortable with annotations and want to take a pass at implementing that feel 
free. If you're interested and not sure where to start join the email list and 
ask there, Nick & I will be happy to assist.

Original comment by eric.dalquist on 29 Jun 2010 at 2:48

GoogleCodeExporter commented 9 years ago

Original comment by eric.dalquist on 29 Jun 2010 at 5:49

GoogleCodeExporter commented 9 years ago

Original comment by eric.dalquist on 29 Jun 2010 at 8:03

GoogleCodeExporter commented 9 years ago
Cool, Thanks a lot! I'll check it out. 
I was just gonna start writing the test case for this and trying to come up 
with a patch, and you have already done it.

Thanks again,

Jiang

Original comment by timobj@gmail.com on 29 Jun 2010 at 8:09