cocachelisted
Install: claude install-skill Ahoo-Wang/skills
# CoCache Development Guide
CoCache is a Java/Kotlin two-level distributed coherent cache framework:
- L2 client-side cache: local Map, Guava, or Caffeine cache.
- L1 distributed cache: Redis-backed shared cache.
- Coherence: `CacheEvictedEventBus` publishes evictions so peer instances invalidate local entries.
## Start Here
Choose the smallest reference that fits the request:
| Task | Read |
|------|------|
| Add CoCache to a Spring or Spring Boot app; configure Redis failure behavior or the missing-guard sentinel | `references/setup.md` |
| Compose cached values with `@JoinCacheable` | `references/join-cache.md` |
| Write or update tests | `references/testing.md` |
| Implement a custom L1/L2 cache, event bus, key converter, or source | `references/custom-implementation.md` |
## Repository Rules
When editing this repository, follow `AGENTS.md`:
- Use `me.ahoo.test.asserts.assert` and `.assert()` in Kotlin tests; do not use AssertJ `assertThat()`.
- Extend the TCK specs in `cocache-test` for cache implementations.
- Ask before changing `cocache-api` public interfaces or adding dependencies.
- Run the relevant Gradle checks before finishing; prefer `./gradlew check` for broad changes.
## Core Model
Define one cache interface per cache domain. The interface extends `Cache<K, V>`, is annotated with `@CoCache`, and is registered through `@EnableCoCache`. CoCache creates a proxy at runtime.
```kotlin
@CoCache(keyPrefix = "user:", ttl = 120)
@GuavaCache(maximumSize = 1_000