AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Cocache

skill-ahoo-wang-skills-cocache · by Ahoo-Wang

Use when building or modifying Java/Kotlin applications with CoCache two-level distributed coherent caching. Invoke for @CoCache cache interfaces, @JoinCacheable composition, Redis-backed coherence, Spring Boot integration, cache proxy behavior, custom cache backends, cache breakdown protection, or CoCache TCK tests.

No reviews yet
0 installs
36 views
0.0% view→install

Install

$ agentstack add skill-ahoo-wang-skills-cocache

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-ahoo-wang-skills-cocache)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
2mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Cocache? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

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 | 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, is annotated with @CoCache, and is registered through @EnableCoCache. CoCache creates a proxy at runtime.

@CoCache(keyPrefix = "user:", ttl = 120)
@GuavaCache(maximumSize = 1_000_000, expireAfterAccess = 120, expireUnit = TimeUnit.SECONDS)
interface UserCache : Cache

@SpringBootApplication
@EnableCoCache(caches = [UserCache::class])
class App

Use caches through Kotlin operators: cache[key], cache[key] = value, cache.evict(key), and cache.getCache(key) when CacheValue metadata is required.

Extension Points

CoCache auto-configures defaults, but each component can be overridden:

  • Per cache, define named beans such as UserCache.CacheSource, UserCache.ClientSideCache, UserCache.KeyConverter, or UserCache.JoinKeyExtractor.
  • Globally, define beans by type; auto-configured beans use @ConditionalOnMissingBean.
  • For data loading, implement CacheSource.loadCacheValue(key) and return DefaultCacheValue.forever(value), DefaultCacheValue.ttlAt(value, ttl), or bounded DefaultCacheValue.missingGuard(ttl, amplitude) values.

Testing Pattern

CoCache provides abstract specs in cocache-test for compatibility coverage:

  • CacheSpec for base cache behavior.
  • ClientSideCacheSpec for L2 caches.
  • DistributedCacheSpec for L1 caches.
  • DefaultCoherentCacheSpec for two-level coherent cache behavior and cache breakdown protection.
  • MultipleInstanceSyncSpec and CacheEvictedEventBusSpec for cross-instance coherence and event buses.

Use the repo's createCacheEntry(): Pair contract:

class MyDistributedCacheTest : DistributedCacheSpec() {
    override fun createCache(): DistributedCache {
        return MyDistributedCache()
    }

    override fun createCacheEntry(): Pair {
        return UUID.randomUUID().toString() to "test_value"
    }
}

Key Classes

| Class | Module | Purpose | |-------|--------|---------| | Cache | cocache-api | Base cache interface | | CoherentCache | cocache-core | Two-level cache engine | | DefaultCoherentCache | cocache-core | Default implementation | | ClientSideCache | cocache-api | L2 local cache interface | | MapClientSideCache | cocache-core | ConcurrentHashMap impl | | GuavaClientSideCache | cocache-core | Guava Cache impl | | CaffeineClientSideCache | cocache-core | Caffeine Cache impl | | DistributedCache | cocache-core | L1 distributed cache interface | | RedisDistributedCache | cocache-spring-redis | Redis impl | | CacheSource | cocache-api | Data source loader | | CacheEvictedEventBus | cocache-core | Event bus for coherence | | RedisCacheEvictedEventBus | cocache-spring-redis | Redis Pub/Sub impl | | JoinCache | cocache-api | Composed cache interface | | SimpleJoinCache | cocache-core | Default JoinCache impl | | KeyFilter | cocache-core | Bloom filter for cache breakdown protection | | BloomKeyFilter | cocache-core | Guava BloomFilter impl |

Build Commands

./gradlew build -x test
./gradlew test
./gradlew :cocache-core:test
./gradlew :cocache-core:test --tests "me.ahoo.cache.proxy.ProxyCacheTest"
./gradlew :cocache-spring-redis:check
./gradlew :cocache-spring-boot-starter:check
./gradlew check

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.