Skip to content

Commit

Permalink
Add short-lived cache for game results
Browse files Browse the repository at this point in the history
  • Loading branch information
Brutus5000 committed Sep 1, 2021
1 parent 56db0ee commit 0f15cd7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/com/faforever/api/config/CacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.faforever.api.data.domain.CoopResult;
import com.faforever.api.data.domain.Event;
import com.faforever.api.data.domain.FeaturedMod;
import com.faforever.api.data.domain.Game;
import com.faforever.api.data.domain.Leaderboard;
import com.faforever.api.data.domain.LeaderboardRating;
import com.faforever.api.data.domain.Map;
Expand Down Expand Up @@ -57,6 +58,7 @@ public CacheManager cacheManager() {
new CaffeineCache(CoopResult.TYPE_NAME, newBuilder().expireAfterWrite(5, MINUTES).build()),
new CaffeineCache(Event.TYPE_NAME, newBuilder().expireAfterWrite(60, MINUTES).build()),
new CaffeineCache(FeaturedMod.TYPE_NAME, newBuilder().expireAfterWrite(60, MINUTES).build()),
new CaffeineCache(Game.TYPE_NAME, newBuilder().expireAfterWrite(1, MINUTES).build()),
new CaffeineCache(Map.TYPE_NAME, newBuilder().expireAfterWrite(60, MINUTES).build()),
new CaffeineCache(MapVersion.TYPE_NAME, newBuilder().expireAfterWrite(60, MINUTES).build()),
new CaffeineCache(MapStatistics.TYPE_NAME, newBuilder().expireAfterWrite(1, MINUTES).build()),
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/com/faforever/api/data/domain/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,16 @@
import java.time.OffsetDateTime;
import java.util.Set;

import static com.faforever.api.data.domain.Game.TYPE_NAME;

@Entity
@Table(name = "game_stats")
@Include(name = "game")
@Include(name = TYPE_NAME)
@Immutable
@Setter
@EntityListeners(GameEnricher.class)
public class Game {
public final static String TYPE_NAME = "game";

private int id;
private OffsetDateTime startTime;
Expand Down

0 comments on commit 0f15cd7

Please sign in to comment.