Files
amethyst/.claude/skills/nostr-expert/references/large-cache.md
Vitor PamplonaandClaude Opus 5.5 395af4dc9c chore(skills): consolidate 33 skills into 14, verified against the tree
The 33 descriptions (~16k chars, ~19k with paths) overran Codex's skill-list
budget (2% of the context window, or 8,000 chars when unknown), and a review
found most bodies stale: paths from before the commons/commonsUI moves, the
deleted legacy desktop app, a callback signer API that no longer exists, and
example APIs that were never in the tree.

Kept, rewritten and checked against the code (every path, class and command):
account-state (+feeds), amy-expert, android-expert, auth-signers,
compose-expert (+API style, Navigation 3 back stacks), desktop-expert
(+run/package), event-store-semantics (+NIP-50 search), find-missing-
translations, kotlin-coroutines (+structured concurrency, flow modeling),
kotlin-multiplatform (+Gradle, composable extraction), ngit-pr,
nip85-trusted-assertions, nostr-expert (+NIP lookup, generated NIP catalog),
relay-client.

Dropped: textbook Compose/Kotlin technique skills, kotlin-expert,
kotlin-types-value-class, gradle-expert, quartz-integration (external-facing;
see the Quartz docs commit), find-non-lambda-logs (audit finished; the rule is
now in AGENTS.md Kotlin Style), and the /nip, /desktop-run, /extract commands.
The skill list is now ~4k chars. Also drops .claude/core-skills-plan.md
(stale history) and repoints SearchableEvent's KDoc to event-store-semantics.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 12:21:01 -04:00

1.3 KiB

LargeCache

quartz/src/commonMain/kotlin/com/vitorpamplona/quartz/utils/cache/LargeCache.kt — expect class LargeCache<K, V>() implementing ICacheOperations<K, V>. It is the store behind LocalCache (commons/.../model/cache/: notes, addressables, users); see the account-state skill for how LocalCache uses it.

Actuals:

  • jvmAndroid/.../LargeCache.jvmAndroid.kt — a ConcurrentSkipListMap.
  • nativeMain/.../LargeCache.native.kt — a lock-free-read, striped-write hash table (StripedHashMap); its KDoc explains why.

API: get, put, remove, containsKey, size, keys(), values(), clear, getOrCreate(key) { builder } (returns the winner under a race), createIfAbsent (true when this call created it), plus the functional scans from ICacheOperations (forEach, filter, filterIntoSet, map, mapNotNull, mapFlatten, count, groupBy, countByGroup, sumOf, maxOrNullOf, associate, …) with collector types in CacheCollectors.kt. Siblings: ConcurrentHashCache.kt, ConcurrentLruCache.kt.

Rules:

  • Use getOrCreate/createIfAbsent, not get then put (a race).
  • Scans run while writers insert; a concurrent write may or may not be seen.
  • No eviction. Bounded caches use ConcurrentLruCache; LocalCache prunes via CachePruner.
  • A small map does not need a LargeCache.