Exposed Ktor Cache Adapter
Latest stable Based on Exposed release 2.0.0
Backend-neutral Ktor readiness contributors for caller-owned Exposed cache repositories and snapshot failure buffers.
Problem
Section titled “Problem”Cache health must be observable without turning a readiness request into database, network, or blocking work.
When to use it
Section titled “When to use it”Use this adapter when a Ktor service wants an O(1) in-memory view of JDBC, R2DBC, snapshot, or custom cache health.
Coordinates
Section titled “Coordinates”implementation(platform("io.github.bluetape4k:bluetape4k-dependencies:<version>"))implementation("io.github.bluetape4k.exposed:bluetape4k-exposed-ktor-cache")Core concepts
Section titled “Core concepts”ExposedKtorCacheContributor sanitizes finite status and measurements. A contributor is caller-owned, side-effect-free, cancellation-cooperative, and bounded to a low-cardinality component name.
Quick start
Section titled “Quick start”val config = ExposedKtorCacheReadinessConfig(listOf( ExposedKtorCacheContributor.custom("local-cache") { ExposedKtorCacheStatus.UP },))val probes = exposedKtorCacheReadinessProbes(config)route.bluetape4kExposedHealthRoutes(probes)API by task
Section titled “API by task”- Use
jdbcRepository,r2dbcRepository,snapshot, orcustomcontributors. - Wrap contributors with
ExposedKtorCacheReadinessConfig. - Convert the immutable configuration with
exposedKtorCacheReadinessProbes.
Recommended patterns
Section titled “Recommended patterns”Read an existing health snapshot; do not perform I/O in a supplier. Use stable component names and let the application own cache invalidation and shutdown.
Integrations
Section titled “Integrations”The adapter depends on core and the Exposed cache foundation. JDBC Caffeine and R2DBC Caffeine persistence implementations remain optional.
Configuration
Section titled “Configuration”Configure one to sixteen unique contributors. Queue and snapshot measurements are non-negative; unavailable values use NaN and are never coerced to zero.
Failure modes
Section titled “Failure modes”Supplier exceptions become DOWN, cancellation follows the request context, and invalid component names or measurements fail at configuration time. Raw cache keys, URLs, SQL, and causes are not returned.
Operations
Section titled “Operations”Cache probes run sequentially under the core shared deadline. Export core readiness metrics and monitor the cache repository’s own lifecycle report separately.
Testing
Section titled “Testing”Test O(1) snapshot conversion, negative-value rejection, supplier cancellation, deadline expiry, duplicate components, and sanitized responses.
Workshops
Section titled “Workshops”No selective cache workshop is published in this 2.0.0 release line.
Limitations
Section titled “Limitations”The contributor contract does not make blocking or backend-I/O suppliers safe. Applications must supply a true in-memory observer.