mirror of
https://github.com/BtbN/ClanServer.git
synced 2026-04-24 07:36:45 -05:00
Don't actively remove cached recommendations, let them expire.
This commit is contained in:
parent
09307826e8
commit
fe568f7576
|
|
@ -20,11 +20,9 @@ namespace ClanServer.Controllers.L44
|
|||
public class GametopController : ControllerBase
|
||||
{
|
||||
private readonly ClanServerContext ctx;
|
||||
private readonly IMemoryCache cache;
|
||||
|
||||
public GametopController(IMemoryCache cache, ClanServerContext ctx)
|
||||
public GametopController(ClanServerContext ctx)
|
||||
{
|
||||
this.cache = cache;
|
||||
this.ctx = ctx;
|
||||
}
|
||||
|
||||
|
|
@ -163,8 +161,6 @@ namespace ClanServer.Controllers.L44
|
|||
bool changed = false;
|
||||
bool freshProfile = false;
|
||||
|
||||
cache.Remove(CacheKeys.GetRecommendedSongsKey(profile.ID));
|
||||
|
||||
if (profile.ClanData == null)
|
||||
{
|
||||
Random rng = new Random();
|
||||
|
|
|
|||
|
|
@ -34,7 +34,8 @@ namespace ClanServer.Controllers.L44
|
|||
List<int> recommendedMusic =
|
||||
await cache.GetOrCreateAsync(CacheKeys.GetRecommendedSongsKey(jid), async entry =>
|
||||
{
|
||||
entry.SlidingExpiration = TimeSpan.FromMinutes(30);
|
||||
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(30);
|
||||
entry.SlidingExpiration = TimeSpan.FromMinutes(2);
|
||||
return (await ClanMusicInfo.Instance).GetRandomSongs(10);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user