-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[OPIK-595]: Add Redis Caching part 1 (#1015)
* [OPIK-595]: Add Redis Caching part 1 * Disable failing test * Add more tests * Support to collections * Use compiler args * Add validation * Add support to Flux * Make wrapper property more generic * Fix format
- Loading branch information
1 parent
53fda9f
commit 272dfb8
Showing
24 changed files
with
1,037 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
apps/opik-backend/src/main/java/com/comet/opik/infrastructure/CacheConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.comet.opik.infrastructure; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import jakarta.validation.Valid; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Data; | ||
|
||
import java.time.Duration; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
@Data | ||
public class CacheConfiguration { | ||
|
||
@Valid @JsonProperty | ||
private boolean enabled = false; | ||
|
||
@Valid @JsonProperty | ||
@NotNull private Duration defaultDuration; | ||
|
||
@Valid @JsonProperty | ||
private Map<String, Duration> caches; | ||
|
||
public Map<String, Duration> getCaches() { | ||
return Optional.ofNullable(caches).orElse(Map.of()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
apps/opik-backend/src/main/java/com/comet/opik/infrastructure/cache/CacheEvict.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.comet.opik.infrastructure.cache; | ||
|
||
import java.lang.annotation.Documented; | ||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Inherited; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Inherited | ||
@Documented | ||
public @interface CacheEvict { | ||
|
||
/** | ||
* @return the name of the cache group. | ||
* */ | ||
String name(); | ||
|
||
/** | ||
* key is a SpEL expression implemented using MVEL. Please refer to the <a href="http://mvel.documentnode.com/">MVEL documentation for more information</a>. | ||
* | ||
* @return SpEL expression evaluated to generate the cache key. | ||
* */ | ||
String key(); | ||
} |
Oops, something went wrong.