Skip to content

Make Cache Configurable#75

Open
DanielDango wants to merge 34 commits into
ardoco:mainfrom
DanielDango:feature/add-cache-configurations
Open

Make Cache Configurable#75
DanielDango wants to merge 34 commits into
ardoco:mainfrom
DanielDango:feature/add-cache-configurations

Conversation

@DanielDango

@DanielDango DanielDango commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

This PR aims to make caches in LiSSA configurable.
Caching with REST-Redis as in #59 can be added afterwards.

The current Redis and Local Cache implementations are split into independent implementations of the Cache interface. Instead, a new Cache, the hierarchical Cache, is added to define how two caches can be coupled. Hierarchical caches can also be coupled with another hierarchical cache. If values are missing in any level of the cache hierarchy, they will be propagated.

The CacheReplacementStrategy Enum describes different conflict resolution strategies (None / Error / Overwrite).
The strategy and general cache hierarchy are defined in environment variables with the defaults of local cache and no consequences on cache conflicts.

The internal local cache implementation has not been altered to keep support for existing local cache files. Their location continues to be specified by the configuration file to enable effortless replication.

Copilot AI review requested due to automatic review settings April 23, 2026 14:52
@DanielDango DanielDango requested a review from dfuchss as a code owner April 23, 2026 14:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

…e/add-cache-configurations

# Conflicts:
#	src/main/java/edu/kit/kastel/sdq/lissa/ratlr/configuration/EvaluationConfiguration.java
@dfuchss dfuchss marked this pull request as draft April 29, 2026 19:13
@DanielDango DanielDango marked this pull request as ready for review May 4, 2026 11:41
Copilot AI review requested due to automatic review settings May 4, 2026 11:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 11 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/HierarchicalCache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheManager.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/HierarchicalCache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java Outdated
Copilot AI review requested due to automatic review settings May 5, 2026 12:43
@sonarqubecloud

sonarqubecloud Bot commented May 5, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheManager.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated

@dfuchss dfuchss left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some initial comments

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java Outdated
@sonarqubecloud

Copy link
Copy Markdown

Copilot AI review requested due to automatic review settings June 1, 2026 06:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 10 comments.

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/CacheReplacementStrategy.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RedisCache.java
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/HierarchicalCache.java Outdated
Comment thread src/test/resources/.env-test Outdated
@DanielDango DanielDango requested a review from dfuchss June 17, 2026 13:42
@DanielDango DanielDango changed the title WIP: Make Cache Configurable Make Cache Configurable Jun 17, 2026
@dfuchss dfuchss requested a review from Copilot June 17, 2026 13:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 7 comments.

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RedisCache.java
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/RedisCache.java Outdated
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java
Comment thread docs/caching.md Outdated
Comment thread src/test/java/edu/kit/kastel/sdq/lissa/ratlr/ArchitectureTest.java
Comment thread src/test/java/edu/kit/kastel/sdq/lissa/ratlr/ArchitectureTest.java
dfuchss and others added 3 commits June 20, 2026 23:32
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.

Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/utils/Environment.java Outdated
Comment on lines +161 to +166
String jsonValue;
try {
jsonValue = mapper.writeValueAsString(Objects.requireNonNull(value));
} catch (JsonProcessingException e) {
throw new IllegalArgumentException("Could not serialize object", e);
}
Comment thread src/main/java/edu/kit/kastel/sdq/lissa/ratlr/cache/Cache.java
Comment on lines +135 to +141
static <K extends CacheKey> Cache<K> createByType(
CacheType type, CacheParameter<K> parameters, @Nullable String cacheDir, @Nullable ObjectMapper mapper) {
return switch (type) {
case LOCAL -> new LocalCache<>(cacheDir, parameters);
case REDIS -> new RedisCache<>(parameters, mapper);
};
}
Comment on lines +361 to +375
/**
* Rule that enforces that CacheManager.resetDefaultInstance() is only called from Test classes.
* <p>
* The resetDefaultInstance() method should only be used to reset the singleton state between tests.
* It must never be called from production code or other test classes.
*/
@ArchTest
static final ArchRule cacheManagerResetOnlyInTests = noClasses()
.that()
.haveNameNotMatching(".*Test.*")
.should()
.callMethod(CacheManager.class, "resetDefaultInstance")
.because(
"CacheManager.resetDefaultInstance() is only intended for testing purposes in CacheTest and must not be used elsewhere");

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants