# xiaolyuh/layering-cache

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/xiaolyuh-layering-cache).**

_How this analysis was created: the description and tags below were written by an AI model that read this project's README and public documentation pages; stars, license and language come straight from the GitHub API. The model does not read the source code._

984 stars · 336 forks · Java · NOASSERTION

## Links

- GitHub: https://github.com/xiaolyuh/layering-cache
- awesome-repositories: https://awesome-repositories.com/repository/xiaolyuh-layering-cache.md

## Description

Layering-cache is a Java caching framework that combines local memory storage with centralized distributed remote storage to handle high-concurrency read requests. It uses method interception via annotations to automatically check stored data and execute underlying logic only when a cache miss occurs. 

The framework maintains data consistency across multiple server instances through publish-subscribe messaging, offset-based queues, and hybrid push-pull synchronization. It prevents sudden traffic spikes and heavy concurrent loads by triggering background threads to automatically refresh expiring entries upon access, caching null results, and processing multiple keys simultaneously in batches. 

Additional capabilities include programmatic cache management for configuring distinct expiration policies, explicit cache updates, entry eviction, and combined execution rules. The library also tracks operational metrics such as hit rates and request counts in memory, periodically syncing them to a central store using distributed locks and exporting statistics to external monitoring systems.

## Tags

### Data & Databases

- [Multi-level Caching](https://awesome-repositories.com/f/data-databases/multi-level-caching.md) — Combines fast local memory storage with centralized distributed remote storage to handle high-concurrency read requests.
- [Declarative Method Caches](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/caching-performance/caching-strategies/query-result-caching/method-result-caches/declarative-method-caches.md) — Intercepts method calls to check cached data first, executes underlying logic only on misses, and stores the resulting return value. ([source](https://github.com/xiaolyuh/layering-cache/wiki/%E6%96%87%E6%A1%A3))
- [Distributed Cache Synchronizers](https://awesome-repositories.com/f/data-databases/distributed-state-synchronizers/distributed-cache-synchronizers.md) — Synchronizes multi-node state across cluster instances using publish-subscribe messaging and distributed locks to maintain data consistency.
- [Annotation-Based Caching](https://awesome-repositories.com/f/data-databases/in-memory-caches/volatile-metric-caches/declarative-caching-strategies/annotation-based-caching.md) — Intercepts method calls using annotations to check cached data first and execute underlying logic only on cache misses.
- [Redis Caching Layers](https://awesome-repositories.com/f/data-databases/redis-caching-layers.md) — Accelerates high-concurrency read requests by layering fast local memory over a centralized Redis distributed cache.
- [Refresh-Ahead Caches](https://awesome-repositories.com/f/data-databases/cache-backend-configurations/read-through-memory-caches/refresh-ahead-caches.md) — Triggers background threads to reload expiring cache entries automatically when accessed, preventing traffic spikes. ([source](https://github.com/xiaolyuh/layering-cache#readme))
- [Stampede Mitigation](https://awesome-repositories.com/f/data-databases/concurrent-write-optimizations/concurrent-caches/stampede-mitigation.md) — Mitigates heavy concurrent database loads by caching null results and refreshing expiring entries asynchronously. ([source](https://github.com/xiaolyuh/layering-cache/blob/master/README.md))
- [Distributed Cache Synchronizations](https://awesome-repositories.com/f/data-databases/distributed-cache-synchronizations.md) — Keeps distributed local cache tiers synchronized across multiple server instances using publish-subscribe messaging and message queues.
- [Topic Offset Consumption](https://awesome-repositories.com/f/data-databases/kafka-message-browsers/kafka-schema-deserializers/topic-consumption/cli-topic-consumers/topic-offset-consumption.md) — Synchronizes multi-level cache tiers across distributed servers using pubsub messaging and offset queues to maintain data consistency.
- [Programmatic Cache Access](https://awesome-repositories.com/f/data-databases/programmatic-cache-access.md) — Provides a programmatic API to execute core cache operations, organize named containers, and configure expiration policies. ([source](https://github.com/xiaolyuh/layering-cache/wiki/%E5%AE%9E%E7%8E%B0%E5%8E%9F%E7%90%86))

### DevOps & Infrastructure

- [Tiered Caching](https://awesome-repositories.com/f/devops-infrastructure/caching-layers/tiered-caching.md) — Combines fast local memory storage with a centralized distributed remote cache to handle high-concurrency read requests efficiently.

### Development Tools & Productivity

- [Data Batching and Caching Utilities](https://awesome-repositories.com/f/development-tools-productivity/batching-utilities/data-batching-and-caching-utilities.md) — Processes multiple keys simultaneously by checking cache entries, fetching missing items, and updating in a single batch. ([source](https://github.com/xiaolyuh/layering-cache/wiki/%E6%96%87%E6%A1%A3))

### Networking & Communication

- [Publish-Subscribe Messaging](https://awesome-repositories.com/f/networking-communication/communication-platforms-services/messaging-notification-systems/messaging-services/message-broker-infrastructure/publish-subscribe-messaging.md) — Keeps distributed local caches consistent across multiple server instances using publish-subscribe messaging to prevent stale reads.

### Software Engineering & Architecture

- [Background Cache Refresh](https://awesome-repositories.com/f/software-engineering-architecture/service-discovery-registries/registry-client-caching/background-cache-refresh.md) — Triggers background threads to reload expiring cache entries automatically upon access to prevent sudden traffic spikes.

### System Administration & Monitoring

- [Cache Performance Monitoring](https://awesome-repositories.com/f/system-administration-monitoring/cache-performance-monitoring.md) — Tracks and reports cache hit statistics using custom reporting extensions and interactive dashboards for operational management. ([source](https://github.com/xiaolyuh/layering-cache/blob/master/README.md))
- [Performance Metrics Exporters](https://awesome-repositories.com/f/system-administration-monitoring/performance-metrics-exporters.md) — Pushes operational statistics like hit rates, request counts, and load times to external monitoring systems for analysis. ([source](https://github.com/xiaolyuh/layering-cache/wiki/%E7%9B%91%E6%8E%A7%E7%BB%9F%E8%AE%A1%E5%8A%9F%E8%83%BD))
- [Key-Value Batching](https://awesome-repositories.com/f/system-administration-monitoring/resource-batch-operations/general-batch-operations/key-value-batching.md) — Processes multiple keys simultaneously by checking existing entries, fetching missing items, and updating the cache in a single batch.
