类 DefaultCacheKeysFactory
- java.lang.Object
-
- org.hibernate.cache.internal.DefaultCacheKeysFactory
-
- 所有已实现的接口:
CacheKeysFactory
public class DefaultCacheKeysFactory extends Object implements CacheKeysFactory
Second level cache providers now have the option to use custom key implementations. This was done as the default key implementation is very generic and is quite a large object to allocate in large quantities at runtime. In some extreme cases, for example when the hit ratio is very low, this was making the efficiency penalty vs its benefits tradeoff questionable. 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 sameType; 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.- 从以下版本开始:
- 5.0
- 作者:
- Sanne Grinovero
- 另请参阅:
Type.getHashCode(Object, SessionFactoryImplementor),Type.isEqual(Object, Object)
-
-
字段概要
字段 修饰符和类型 字段 说明 static DefaultCacheKeysFactoryINSTANCEstatic StringSHORT_NAME
-
构造器概要
构造器 构造器 说明 DefaultCacheKeysFactory()
-
方法概要
-
-
-
字段详细资料
-
INSTANCE
public static final DefaultCacheKeysFactory INSTANCE
-
-
方法详细资料
-
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)
-
staticCreateNaturalIdKey
public static Object staticCreateNaturalIdKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session)
-
createCollectionKey
public Object createCollectionKey(Object id, CollectionPersister persister, SessionFactoryImplementor factory, String tenantIdentifier)
- 指定者:
createCollectionKey在接口中CacheKeysFactory
-
createEntityKey
public Object createEntityKey(Object id, EntityPersister persister, SessionFactoryImplementor factory, String tenantIdentifier)
- 指定者:
createEntityKey在接口中CacheKeysFactory
-
createNaturalIdKey
public Object createNaturalIdKey(Object[] naturalIdValues, EntityPersister persister, SharedSessionContractImplementor session)
- 指定者:
createNaturalIdKey在接口中CacheKeysFactory
-
getEntityId
public Object getEntityId(Object cacheKey)
- 指定者:
getEntityId在接口中CacheKeysFactory
-
getCollectionId
public Object getCollectionId(Object cacheKey)
- 指定者:
getCollectionId在接口中CacheKeysFactory
-
getNaturalIdValues
public Object[] getNaturalIdValues(Object cacheKey)
- 指定者:
getNaturalIdValues在接口中CacheKeysFactory
-
-