Skip to content

Commit 559e2ff

Browse files
author
Wilson Neto B.R.
authored
Add important notes on HybridCache limitations and behavior
- Added a note indicating that removing cache entries by tag is still under development and is currently non-functional. - Clarified that cache invalidation by key or tags affects only the current node and secondary storage, but not other nodes' in-memory cache. Ask Copilot
1 parent 9771604 commit 559e2ff

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

aspnetcore/performance/caching/hybrid.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ When an entry is removed, it is removed from both the primary and secondary cach
7373

7474
## Remove cache entries by tag
7575

76+
> [!IMPORTANT]
77+
> This feature is still under development. If you try to remove entries by tag, you will notice that it won't cause any effect yet.
78+
7679
Tags can be used to group cache entries and invalidate them together.
7780

7881
Set tags when calling `GetOrCreateAsync`, as shown in the following example:
@@ -145,6 +148,8 @@ For more information, see the [HybridCache serialization sample app](https://git
145148

146149
By default `HybridCache` uses <xref:System.Runtime.Caching.MemoryCache> for its primary cache storage. Cache entries are stored in-process, so each server has a separate cache that is lost whenever the server process is restarted. For secondary out-of-process storage, such as Redis or SQL Server, `HybridCache` uses [the configured `IDistributedCache` implementation](xref:performance/caching/distributed), if any. But even without an `IDistributedCache`implementation, the `HybridCache` service still provides in-process caching and [stampede protection](https://en.wikipedia.org/wiki/Cache_stampede).
147150

151+
**Note:** When invalidating the cache by key or by tags, it will be invalidated in the current node and in the secondary out-of-process storage. However, the in-memory cache on other nodes will not be affected.
152+
148153
## Optimize performance
149154

150155
To optimize performance, configure `HybridCache` to reuse objects and avoid `byte[]` allocations.

0 commit comments

Comments
 (0)