Skip to content

Class SimpleCache ​

Namespace: Belay.Core
Assembly: Belay.Core.dll

Simple, efficient caching implementation that replaces the complex caching infrastructure. Uses basic memoization suitable for MicroPython device operations.

csharp
public static class SimpleCache

Inheritance ​

object ← SimpleCache

Inherited Members ​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Properties ​

Count

Gets the current number of cached items.

Methods ​

Clear()

Clears all cached values.

ContainsKey(string)

Checks if a key exists in the cache.

GetOrCreate<T>(string, Func<T>)

Gets a cached value or creates it using the factory function.

GetOrCreateAsync<T>(string, Func<Task<T>>, CancellationToken)

Gets a cached value or creates it asynchronously using the factory function. Thread-safe implementation prevents multiple concurrent factory executions.

Remove(string)

Removes a specific cached value.

Released under the Apache License 2.0.