Interface ICache
- Namespace
- MoonBark.GridPlacement.Core.Interfaces
- Assembly
- MoonBark.GridPlacement.Core.dll
Simplified cache interface for string keys (most common use case).
public interface ICache : ICache<string, object>
- Inherited Members
Methods
GetOrAdd<T>(string, Func<T>)
Gets a typed value from the cache, or creates it if it doesn't exist.
T GetOrAdd<T>(string key, Func<T> factory)
Parameters
Returns
- T
The cached or newly created value
Type Parameters
TThe value type
Get<T>(string)
Gets a typed value from the cache.
T Get<T>(string key)
Parameters
keystringThe cache key
Returns
- T
The cached value
Type Parameters
TThe value type
Set<T>(string, T)
Sets a typed value in the cache.
void Set<T>(string key, T value)
Parameters
keystringThe cache key
valueTThe value to cache
Type Parameters
TThe value type
TryGetValue<T>(string, out T)
Attempts to get a typed value from the cache.
bool TryGetValue<T>(string key, out T value)
Parameters
keystringThe cache key
valueTThe cached value if found
Returns
- bool
True if the value was found and has correct type, false otherwise
Type Parameters
TThe value type