Skip to content

Commit 7803c73

Browse files
committed
also expire key after update
1 parent bae1fe7 commit 7803c73

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/Http/Controllers/BeatmapTagsController.php

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ public function update($beatmapId, $tagId)
4646
->beatmapTags()
4747
->firstOrCreate(['beatmap_id' => $beatmapId, 'user_id' => \Auth::user()->getKey()]);
4848

49+
$beatmap->expireTopTagIds();
50+
4951
return response()->noContent();
5052
}
5153
}

app/Models/Beatmap.php

+5
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,11 @@ public function canBeConvertedTo(int $rulesetId)
251251
return $this->playmode === static::MODES['osu'] || $this->playmode === $rulesetId;
252252
}
253253

254+
public function expireTopTagIds()
255+
{
256+
cache_expire_with_fallback("beatmap_top_tag_ids:{$this->getKey()}", $GLOBALS['cfg']['osu']['tags']['beatmap_tags_cache_duration']);
257+
}
258+
254259
public function getAttribute($key)
255260
{
256261
return match ($key) {

0 commit comments

Comments
 (0)