feat(replay): add BattleHistoryWriter with 50-row per-viewer retention
Idempotent on (ViewerId, BattleId); evicts oldest CreateTime row when at cap. No-op when ctx is null (server-restart safety). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,7 @@ using SVSim.Database.Repositories.Story;
|
||||
using SVSim.Database.Repositories.Viewer;
|
||||
using SVSim.Database.Services;
|
||||
using SVSim.Database.Services.Friend;
|
||||
using SVSim.Database.Services.Replay;
|
||||
using SVSim.EmulatedEntrypoint.Configuration;
|
||||
using SVSim.EmulatedEntrypoint.Extensions;
|
||||
using SVSim.EmulatedEntrypoint.Matching;
|
||||
@@ -116,6 +117,9 @@ public class Program
|
||||
builder.Services.AddScoped<IFriendService, FriendService>();
|
||||
builder.Services.AddScoped<IPlayedTogetherWriter, FriendService>();
|
||||
|
||||
builder.Services.AddSingleton<IBattleContextStore, InMemoryBattleContextStore>();
|
||||
builder.Services.AddScoped<IBattleHistoryWriter, BattleHistoryWriter>();
|
||||
|
||||
// Deck-code mint/resolve uses IMemoryCache for ephemeral (3-min TTL) storage; no DB
|
||||
// row, no migration. Singleton because the cache + RNG seam are process-wide.
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
Reference in New Issue
Block a user