Skip to content

Commit

Permalink
finalize hybrid cache article
Browse files Browse the repository at this point in the history
  • Loading branch information
EngincanV committed Nov 1, 2024
1 parent e66e1e7 commit 9dc2350
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/en/Community-Articles/2024-11-01-Hybrid-Cache-Net-9/POST.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ public class BookCacheItem
* In this example, you used the `GetOrCreateAsync` method, which first tries to get the cache item with the provided cache key, if there is no cache with the specified key, then it runs the factory method and add the returned data to the cache.
* Alternatively, you can use the `SetAsync` method to set the cache item.

### Debugging the `IHybridCache` Service (deep-dive)

When you debug the `IHybridCache` service, you'll notice the L1 and L2 cache stores. (L1 is in-memory cache store and L2 is the distributed cache store):

![](debug-hybrid-cache.png)

As you can see from the figure, it only set the cache item to the **LocalCache** (`MemoryCache`) and did not set the **BackendCache** (`DistributedCache`) because I did not configure the distributed cache and not running my application in multiple instances. But as you can notice, even without an `IDistributedCache` configuration, the `HybridCache` service will still provide in-process caching.

**Note:** If you configure distributed caching options, `HybridCache` service uses the distributed cache and sets the **BackendCache**.

## Conclusion

The **HybridCache** library in .NET 9 provides a powerful tool for applications needing both high-speed caching and consistency in distributed environments.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9dc2350

Please sign in to comment.