Hello caching experts!
At last minute before Hibernate ORM 5, I'm proposing a change in the
second level caching SPI.
I've already implemented it, including patching both the Ehcache and
Infinispan modules to satisfy the new requirement, so you don't have
to do much but please have a look and hopefully approve:
-
https://github.com/hibernate/hibernate-orm/pull/974
The summary is:
- The CacheKey SPI is changed to an interface
- I'm adding a factory method to each Region to allow the cache
implementor to produce its own key implementations
- Patched all current Region implementations to simply produce the
old, proven key implementation.
- Changed all code in ORM which deals with cache access to
exclusively use the new factory.
- All signatures using a "key" have been changed from Object to the
respective contract
Since Hibernate ORM 5 is almost ready I'm only defining the API
changes; the description on the PR should give some possible
suggestions of optimisations which we could then play with.
As a background: we had several tests showing that the allocation cost
of the CacheKey implementation being "imposed" by the Hibernate core
was quite high; this is a first step to improve that, to allow
slimming of these but also possible further crazy ideas such as
HHH-9780.
Thanks,
Sanne