Open GoogleCodeExporter opened 9 years ago
The origin of this problem is line 139 of HashCodeKeyGenerator:
generator.hash = MULTIPLIER * generator.hash + ((Long)e).longValue();
where MULTIPLIER is 31.
With the HashCodeKeyGenerator you will always get duplicate keys. A different
MULTIPLIER only may decrease the propability of duplicate keys.
You could use the ListCacheKeyGenerator instead of the HashCodeKeyGenerator.
Original comment by StefanFriedrichBirkner
on 24 Sep 2012 at 1:21
I suppose if ehcache is giving you same hashes for some combinations of
parameters it may cause some apps crashes as I encounter recently. If f.e.
app is body health critical it may cause sad result and take too long to be
found and resolved as the hashes intersection problem is not obvious.
Why not to use some bit mask constructed from parameters that added as
boolean AND to resulting hash.
On Mon, Sep 24, 2012 at 4:21 PM,
<ehcache-spring-annotations@googlecode.com>wrote:
Original comment by usate...@gmail.com
on 24 Sep 2012 at 1:55
the default key generator should be StringCacheKeyGenerator instead of
HashCodeCacheKeyGenerator. Otherwise method invocation with different param
values will have the same key! Pretty bad stuff I think.
Original comment by alexg...@gmail.com
on 6 Feb 2014 at 3:16
Original issue reported on code.google.com by
usate...@gmail.com
on 11 May 2012 at 10:38