Skip to content
Bluetape4k docs1.11

Properties and Hibernate mapping

Latest stable Based on Bluetape4k release 1.11.0

LettuceNearCacheSpringProperties uses the prefix bluetape4k.cache.lettuce-near.

Spring propertyDefaultMeaning
enabledtrueEnable all auto-configuration
redis-uriredis://localhost:6379Redis connection URI
codeclz4foryCache value codec
use-resp3trueUse RESP3 client tracking
local.max-size10000Maximum Caffeine L1 entry count
local.expire-after-write30mL1 expiry after write
redis-ttl.default120sDefault Redis L2 TTL
metrics.enabledtrueEnable Hibernate statistics and binder
metrics.enable-caffeine-statstrueRecord local Caffeine statistics

The default Redis URI is for development convenience. Set it explicitly in production configuration and review TLS, authentication, and timeout policy with the lower-level Lettuce setup.

The customizer always selects LettuceNearCacheRegionFactory and enables second-level cache.

Spring propertyHibernate property
redis-urihibernate.cache.lettuce.redis_uri
codechibernate.cache.lettuce.codec
use-resp3hibernate.cache.lettuce.use_resp3
local.max-sizehibernate.cache.lettuce.local.max_size
local.expire-after-writehibernate.cache.lettuce.local.expire_after_write
redis-ttl.defaulthibernate.cache.lettuce.redis_ttl.default
redis-ttl.regions[name]hibernate.cache.lettuce.redis_ttl.{name}
metrics.enabled=truehibernate.generate_statistics=true
metrics.enable-caffeine-stats=truehibernate.cache.lettuce.local.record_stats=true

Disabling metrics omits the related keys rather than writing false. Check the final merge order if the application defines the same Hibernate properties elsewhere.

A duration divisible by a second becomes 60s; all others use milliseconds, such as 500ms.

local:
expire-after-write: 500ms
redis-ttl:
default: 1500ms

The 1.11.0 tests verify that both values remain 500ms and 1500ms; sub-second values are not rounded to seconds.

The regions map overrides the default TTL.

redis-ttl:
default: 120s
regions:
product: 300s
"[com.example.Order]": 600s

Bracket dotted region names so Spring binding does not split them. The generated Hibernate key preserves the dots. The map key must exactly match the entity annotation’s region name.

  • L1 capacity counts entries, not bytes.
  • L1 expiry and Redis TTL apply to different tiers.
  • use-resp3=true assumes Redis 6+ and client tracking.
  • A codec change may make existing Redis values unreadable; plan cache transition or flush.
  • Statistics have a cost; confirm the needed level under load.