iluwatar / iluwatar/java-design-patterns

Caching Filter pattern

Open
#1,266 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

epic: pattern info: help wanted type: feature
Dominant language
Java
Stars
94.7k
Forks
27.4k
Avg merge
3d 4h
Merged PRs (30d)
10

Description

Description:
The Caching Filter design pattern aims to improve the performance and scalability of an application by caching the results of expensive operations and reusing them for identical subsequent requests. This pattern is particularly useful in scenarios where the same data is frequently requested, and the cost of recomputing the data is high.

Main Elements of the Pattern:

  1. Filter: Intercepts requests and checks if a cached response is available.
  2. Cache Store: A storage mechanism for saving and retrieving cached data.
  3. Cache Key: A unique identifier for caching entries based on request parameters.
  4. Expiration Policy: Defines how long cached data is considered valid.
  5. Cache Miss Handler: Fetches data from the original source when a cache miss occurs and populates the cache.

References:

Acceptance Criteria:

  1. Implement a basic Caching Filter that can intercept requests and check for cached responses.
  2. Develop a simple cache store with a configurable expiration policy.
  3. Ensure comprehensive unit tests are provided to validate the correct functionality of the caching mechanism.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file, entry point, or test location is named in the issue, so begin by reviewing the existing Java design-pattern examples in the repository and identifying where a Caching Filter belongs. Done means implementing the requested filter, cache store, expiration policy, cache-miss handling, and comprehensive unit tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.