mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Add basic base class to begin to standardise function across caching components
This commit is contained in:
17
osu.Game/Database/MemoryCachingComponent.cs
Normal file
17
osu.Game/Database/MemoryCachingComponent.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
/// <summary>
|
||||
/// A component which performs lookups (or calculations) and caches the results.
|
||||
/// Currently not persisted between game sessions.
|
||||
/// </summary>
|
||||
public abstract class MemoryCachingComponent<TLookup, TValue> : Component
|
||||
{
|
||||
protected readonly ConcurrentDictionary<TLookup, TValue> Cache = new ConcurrentDictionary<TLookup, TValue>();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user