[API Proposal]: Allow to invalidate only local storage via `HybridCache.RemoveAsync`
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 894
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
### Background and motivation
Currently it is impossible to invalidate only local cache without rewriting the value via `HybridCache.SetAsync`. `HybridCache.RemoveAsync` will remove entry from both local and remote cache.
The main usage would be to provide user defined workaround until https://github.com/dotnet/extensions/issues/5517 is designed and implemented and/or lazy approach for invalidation.
### API Proposal
```csharp
public enum HybridCacheRemoveMode
{
Full = 0,
LocalOnly = 1
}
```
And extend corresponding methods with it^
```c#
public class HybridCache
{
public abstract ValueTask RemoveAsync(string key, HybridCacheRemoveMode mode = default, CancellationToken cancellationToken = default);
// ....
}
```
### API Usage
```csharp
HybridCache hc = ...;
await hc.RemoveAsync("key", HybridCacheRemoveMode.LocalOnly);
```
### Alternative Designs
_No response_
### Risks
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.