Skip to content

1.1.55

Latest

Choose a tag to compare

@Hyshmily Hyshmily released this 11 Jul 01:16

Rebranding & Configuration

  • Package renameio.github.hyshmily.hotkeyio.github.hyshmily.zeta, all class names and imports updated accordingly.
  • Configuration prefixhotkey.*zeta.* (including local, sync, worker, report, spring‑cache, etc.).
  • Artifact IDshotkey-parentzeta-parent, hotkeyzeta, hotkey-workerzeta-worker.
  • Exchange/queue names — Default exchange names (zeta.report.exchange, zeta.heartbeat.exchange), queue prefixes, and Redis key prefixes all switched to zeta:*.

Architecture & Core Refactoring

  • Interface/Impl split — Most concrete classes (e.g., SingleFlight, CircuitBreaker, ExpireManager, RingManager, HealthView, SreRateLimiter, VersionController, SystemLoadMonitor) are now public interfaces with package‑private implementation classes in impl/ sub‑packages.
  • CentralDispatcher — Replaces scattered direct calls to CacheSyncPublisher and HotKeyReporter; provides unified recordAccess() and send() coordination.
  • CacheCompressor abstraction — Value‑level LZ4 compression/decompression via Lz4CacheCompressor (falls back to no‑op if LZ4 unavailable).
  • Memory‑weighted eviction — New CacheConfig with max‑weight (bytes) and DefaultWeigher to enforce memory‑based limits (overrides entry‑count when set).
  • @Internal marker — Annotates classes not intended for public API consumption.

New Capabilities

  • Atomic computeIfAbsent — Uses Caffeine's compute() within stripe lock, eliminating TOCTOU race between lookup and load.
  • CAS operationscompareAndSet() and compareAndInvalidate() for lock‑free optimistic updates.
  • Batch getget(Iterable<String>, Function, ...) for bulk read‑through with per‑key TTL/report control.
  • Timed refresh schedulerregisterRefresh(), updateRefresh(), unregisterRefresh() with a lazy 2‑thread pool for background periodic refresh.
  • Per‑key ordered dispatcherPerKeyOrderedDispatcher ensures FIFO execution of tasks for the same key in both CacheSyncListener and WorkerListener.
  • Concurrent‑threads interception — New InterceptTrigger.CONCURRENT_THREADS with concurrentThreads() attribute to guard per‑key thread count.
  • Broadcast control — All invalidate(), putThrough(), invalidateAfterPut() methods now accept an isBroadcastByThisTime parameter; invalidate(keys, false) replaces evictLocal().
  • Multi‑key mutate‑invalidate — Batch invalidateAfterPut(Map) overload for atomic invalidations.

Fixes & Improvements

  • Worker broadcast rollbackWorkerBroadcaster.broadcastHot/Cool() returns boolean; ReportConsumer calls rollbackToPreviousState() when broadcast fails, preventing state drift.
  • INVALIDATE vs REFRESH raceCacheSyncListener tracks recentInvalidated high‑water mark per key, skipping stale REFRESH after an INVALIDATE.
  • Stale‑return on circuit‑breaker openHotKeyCache.mapEmpty() now returns the stale CacheEntry (if available) when circuit‑breaker is open, instead of Optional.empty().
  • ExpireManager centralization — All CacheEntry construction flows through ExpireManager.createBuilder(), applyTtl(), replaceEntryValue(), unifying TTL logic and compression.

Dependency & Build Changes

  • New dependenciesorg.lz4:lz4‑java:1.8.0 (compression), org.apache.lucene:lucene‑core:10.5.0 (root POM) and 9.12.0 (common POM – version mismatch, likely intentional for compatibility).
  • JaCoCo excludes — Updated package paths from io/github/hyshmily/hotkey/* to io/github/hyshmily/zeta/*.
  • Main classWorkerApplication moved to io.github.hyshmily.zeta.worker.

Removed / Deprecated

  • evictLocal() — Replaced by invalidate(key, false).
  • putBeforeInvalidate() — Replaced by invalidateAfterPut() with broadcast control.
  • Batch computeIfAbsent(Collection, Function, ...) — Removed; use single‑key atomics plus new batch get() instead.
  • HotKey* classes — All renamed to Zeta* (e.g., HotKeyCacheStatsZetaCacheStats, HotKeyDecisionZetaDecision).
  • Old endpoint paths/actuator/hotkey/actuator/zeta, /actuator/hotkey/worker/state/actuator/zeta/worker/state.