A memory based cache for a given model type designed to store and retrieve instances of models and collections of ids with associated arrival timestamps.
More...
|
|
| ModelClassCache () |
| | ModelClassCache Constructor.
|
| async Task | Setup () |
| | Implement this for any setup required.
|
| async Task< OpResponse > | Fetch (RequestOp requestOp) |
| | Fetches the requested model or collection from the cache if available and fresh enough; otherwise returns a none response to indicate a miss.
|
| async Task< Model?> | Fetch< Model > (object id, int freshnessSeconds=0) |
| | Fetches a model instance from the cache if available and within freshness period.
|
| async Task | Store (object id, object model, long arrivedAt) |
| | Stores a model instance in the cache with the arrived timestamp.
|
| async Task | StoreAll (IReadOnlyList< object > results, long arrivedAt) |
| async Task | StoreCollection (string key, IEnumerable ids, long arrivedAt) |
| | Stores a collection of ids in the cache with the specified name key and arrived timestamp.
|
| Task | Remove (object id) |
| | Removes a model instance from the cache based on the given id.
|
| async Task | Remove (IdType id) |
| | Removes a model instance from the cache using the typed id.
|
| async Task | ClearAll (bool exceptHeld, DateTime? olderThan=null) |
| | Clears all models and collections from the cache, optionally holding certain elements if specified.
|
A memory based cache for a given model type designed to store and retrieve instances of models and collections of ids with associated arrival timestamps.
◆ ClearAll()
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.ClearAll |
( |
bool | exceptHeld, |
|
|
DateTime? | olderThan = null ) |
|
inline |
Clears all models and collections from the cache, optionally holding certain elements if specified.
- Parameters
-
| exceptHeld | Indicates whether to exclude certain held items from clearing. |
| olderThan | Optionally specifies a date threshold to restrict which items are cleared. |
Implements Buzzware.Cascade.IModelClassCache.
◆ Fetch()
| async Task< OpResponse > Buzzware.Cascade.ModelClassCache< Model, IdType >.Fetch |
( |
RequestOp | requestOp | ) |
|
|
inline |
Fetches the requested model or collection from the cache if available and fresh enough; otherwise returns a none response to indicate a miss.
- Parameters
-
| requestOp | The operation object containing request details for fetching data. |
- Returns
- An OpResponse object containing details about the request result.
Implements Buzzware.Cascade.IModelClassCache.
◆ Fetch< Model >()
| async Task< Model?> Buzzware.Cascade.ModelClassCache< Model, IdType >.Fetch< Model > |
( |
object | id, |
|
|
int | freshnessSeconds = 0 ) |
|
inline |
Fetches a model instance from the cache if available and within freshness period.
- Template Parameters
-
| Model | The type of model being requested. |
- Parameters
-
| id | The identifier for the model instance. |
| freshnessSeconds | The maximum acceptable age of the cached data in seconds. |
- Returns
- The model instance if found and fresh enough, otherwise null.
◆ Remove() [1/2]
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.Remove |
( |
IdType | id | ) |
|
|
inline |
Removes a model instance from the cache using the typed id.
- Parameters
-
| id | The strongly typed identifier of the model to remove. |
◆ Remove() [2/2]
| Task Buzzware.Cascade.ModelClassCache< Model, IdType >.Remove |
( |
object | id | ) |
|
|
inline |
Removes a model instance from the cache based on the given id.
- Parameters
-
| id | The identifier of the model to remove. |
- Returns
Implements Buzzware.Cascade.IModelClassCache.
◆ Setup()
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.Setup |
( |
| ) |
|
|
inline |
◆ Store()
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.Store |
( |
object | id, |
|
|
object | model, |
|
|
long | arrivedAt ) |
|
inline |
Stores a model instance in the cache with the arrived timestamp.
- Parameters
-
| id | The identifier representing the model. |
| model | The model object to be stored. |
| arrivedAt | The timestamp when the model data was obtained. |
Implements Buzzware.Cascade.IModelClassCache.
◆ StoreAll()
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.StoreAll |
( |
IReadOnlyList< object > | results, |
|
|
long | arrivedAt ) |
|
inline |
◆ StoreCollection()
| async Task Buzzware.Cascade.ModelClassCache< Model, IdType >.StoreCollection |
( |
string | key, |
|
|
IEnumerable | ids, |
|
|
long | arrivedAt ) |
|
inline |
Stores a collection of ids in the cache with the specified name key and arrived timestamp.
- Parameters
-
| key | A unique key identifying the collection. |
| ids | The enumerable collection of model identifiers. |
| arrivedAt | The timestamp when the collection data was obtained. |
Implements Buzzware.Cascade.IModelClassCache.
◆ Cascade
The documentation for this class was generated from the following file:
- Buzzware.Cascade/ModelClassCache.cs