Skip to content
Bluetape4k docs1.11

Lifecycle, failures, and operations

Latest stable Based on Bluetape4k release 1.11.0

On prepareForUse, Hibernate validates settings and the codec, creates a RedisClient, applies RESP3 when enabled, assigns the client, and registers it with ShutdownQueue.

Shutdown order matters:

  1. Close every region Near Cache and tracking connection.
  2. Clear the region map.
  3. Shut down and null the shared RedisClient.

Closing the client first would leave caches trying to clean up through a stopped client. StorageAccess.release() is intentionally a no-op because RegionFactory owns shared caches. Close the SessionFactory explicitly to run this lifecycle.

Convert cache failures into database fallback

Section titled “Convert cache failures into database fallback”
OperationResult after cache failure
getFromCacheWarn and return null; Hibernate reads the database
putIntoCacheWarn and ignore; transaction continues
containsWarn and return false
Key or region evictionWarn and ignore

This prevents a Redis outage from directly failing a business transaction. It can instead create a miss storm against the database or leave stale local entries after failed eviction. Correlate cache errors with database-pool pressure.

evictData(key) removes L1 state and calls Redis UNLINK. Region-wide evictData() clears L1, scans ${regionName}:*, and unlinks batches.

clearAll() is not constant-time. Large regions need multiple scan round trips. Avoid routine global eviction; plan namespace or version transitions for schema and serialization changes.

  • Hibernate second-level hits, misses, and puts
  • Per-region CacheRegionStatistics
  • Query-cache and update-timestamps activity
  • Caffeine size and hit rate with stats enabled
  • Redis latency, errors, reconnects, and connections
  • Database latency and pool active or pending counts
  • Region eviction duration and deleted-key count

A high hit rate does not compensate for stale reads or a fallback overload. Compare p95/p99, database load, and correctness against a cache-disabled baseline.

Stop Redis briefly and verify database fallback, pool capacity, and repopulation after recovery. Modify a key through another process to verify RESP3 invalidation. Before changing codecs, prove backward readability or prepare a bounded region-eviction procedure.