Swr.Net assembly
Swr.Net assembly
Section titled “Swr.Net assembly”Swr.Net namespace
Section titled “Swr.Net namespace”| public type | description |
|---|---|
| interface ISwr | Provides stale-while-revalidate caching with user-supplied fetchers. Register via AddSwrForBlazor or AddSwrForAspNetCore. |
| record SwrOptions | Configuration options for SWR caching behavior. Can be set globally via DI or overridden per request. |
| class SwrResult<T> | Represents the result of an SWR cache lookup. Properties update asynchronously as data flows through cache hit, network fetch, and background revalidation. |
Swr.Net.Extensions namespace
Section titled “Swr.Net.Extensions namespace”| public type | description |
|---|---|
| static class SwrServiceCollectionExtensions | Extension methods for registering Swr.Net services with the DI container. |
Swr.Net.Keys namespace
Section titled “Swr.Net.Keys namespace”| public type | description |
|---|---|
| static class SwrCacheKey | Utilities for normalizing and constructing SWR cache keys. |
Swr.Net.Store namespace
Section titled “Swr.Net.Store namespace”| public type | description |
|---|---|
| record CacheEntry | Represents a cached data entry with its storage timestamp. Used by ISwrStore implementations to track cache age. |
| interface ISwrStore | Abstraction for the SWR cache storage backend. Implement this to use a custom store (e.g., Redis via IDistributedCache). The default implementation is an in-memory ConcurrentDictionary-based store. |