0

I just found that SimpleKeyGenerator returns a SimpleKey which concerns method parameters only.

Say, what if, following two different service methods have same parameters?

@Cacheable
long countInAWay(..., ..., ...);

@Cacheable
long countInADifferentWay(..., ..., ...);

What happen to the cache when these two methods are invoke with exactly the same parameters? Do those keys collide?

Jin Kwon
  • 20,295
  • 14
  • 115
  • 184
  • 1
    Can't you specify `@Cacheable("countInAWay")` and `@Cacheable("countInADifferentWay")` to explicetly differentiate them? – StanislavL Jan 15 '18 at 06:54
  • @StanislavL Of course, I can. Is it the best way? Thank you. – Jin Kwon Jan 15 '18 at 07:02
  • 1
    In theory it's possible to extend the @Cacheable to use e.g. class name + method name but what if you have 2 versions of the same class loaded in e.g. two different web applications on the same server. There could be different strategies. – StanislavL Jan 15 '18 at 07:19

0 Answers0