Class DefaultCacheKeysFactory
- All Implemented Interfaces:
CacheKeysFactory
Depending on configuration settings there might be opportunities to use simpler key implementations, for example when multi-tenancy is not being used to avoid the tenant identifier, or when a cache instance is entirely dedicated to a single type to use the primary id only, skipping the role or entity name.
Even with multiple types sharing the same cache, their identifiers could be of the same
Type
; in this case the cache container could
use a single type reference to implement a custom equality function without having
to look it up on each equality check: that's a small optimisation but the
equality function is often invoked extremely frequently.
Another reason is to make it more convenient to implement custom serialization protocols when the implementation supports clustering.
- Since:
- 5.0
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCollectionKey
(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) createEntityKey
(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) createNaturalIdKey
(Object naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session) getCollectionId
(Object cacheKey) getEntityId
(Object cacheKey) getNaturalIdValues
(Object cacheKey) static Object
staticCreateCollectionKey
(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) static Object
staticCreateEntityKey
(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) static Object
staticCreateNaturalIdKey
(Object naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session) static Object
staticGetCollectionId
(Object cacheKey) static Object
staticGetEntityId
(Object cacheKey) static Object
staticGetNaturalIdValues
(Object cacheKey)
-
Field Details
-
SHORT_NAME
- See Also:
-
INSTANCE
-
-
Constructor Details
-
DefaultCacheKeysFactory
public DefaultCacheKeysFactory()
-
-
Method Details
-
staticCreateCollectionKey
public static Object staticCreateCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) -
staticCreateEntityKey
public static Object staticCreateEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) -
staticGetEntityId
-
staticGetCollectionId
-
staticGetNaturalIdValues
-
createCollectionKey
public Object createCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) - Specified by:
createCollectionKey
in interfaceCacheKeysFactory
-
createEntityKey
public Object createEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier) - Specified by:
createEntityKey
in interfaceCacheKeysFactory
-
getEntityId
- Specified by:
getEntityId
in interfaceCacheKeysFactory
-
getCollectionId
- Specified by:
getCollectionId
in interfaceCacheKeysFactory
-
getNaturalIdValues
- Specified by:
getNaturalIdValues
in interfaceCacheKeysFactory
-