Is it possible to limit the size of Hibernate second-level-cache for a specific entity? -
i have scenario hibernate second-level-cache enabled , i'd cache entity 1000 instances created every day , retained 8 years queries deal recent 2 days. avoid having create history table because rare cases historical lookup, code dependent on date.
is possible in hibernate, infinispan level-2 provider, configure specifically, particular cache specific attributes (eviction policy, size, etc.) hibernate should use entity foo?
yes. in hibernate, can have n cache "regions", can have different configurations , can specific entities. configuration dependent on provider (infinispan, in case). see document more details on infinispan configuration:
look @ examples on how override defaults entity/collection. there, can set eviction strategy, lifespan , number of entities keep in cache.
Comments
Post a Comment