Skip to content

Commit 13875c6

Browse files
authored
Update ef-core-query-cache.md
1 parent 49c5894 commit 13875c6

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

docs2/pages/ef-core-docs/documentations/query-cache/ef-core-query-cache.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,53 @@ var countries2 = ctx.Countries.FromCache().ToList();
3030

3131
```
3232
[Try it](https://dotnetfiddle.net/EZZkhP)
33+
34+
## Scenarios
35+
36+
- [Query Criteria](scenarios/ef-core-query-cache-using-query-criteria.md)
37+
- [Query Deferred](scenarios/ef-core-query-cache-query-deferred.md)
38+
- [Tag & ExpireTag](scenarios/ef-core-query-cache-tag.md)
39+
- [Expiration](scenarios/ef-core-query-cache-expiration.md)
40+
- [Query Cache Control](scenarios/ef-core-query-cache-control.md)
41+
42+
## Real Life Scenarios
43+
44+
- Caching read-only data like application configuration.
45+
- Caching data that cQuery Cache Controlan only be modified via an importation like states & countries and make all cache entries related expired once the importation is completed (Tag Expiration).
46+
- Caching data that are frequently accessed but rarely modified like comments and expire the tag when a new comment is added or after one hour without any access (Tag Expiration & Sliding Expiration).
47+
- Caching statistics that don't require to be live like client count and expire them every hour (Absolute Expiration).
48+
49+
## Behind the code
50+
51+
When **FromCache** is invoked, The QueryCacheManager returns the result if a cache entry exists for the cache key. If no cache entry exists, the query is materialized then cached in the memory using the cache key before being returned. If a cache tag is specified, the cache key is also stored in a concurrent dictionary for all tags.
52+
53+
- **The Cache:** The memory cache is used by default.
54+
55+
- **The Cache Key:** The cache key is created by combining a cache prefix, all cache tags and the query expression.
56+
57+
- **The Query Materialized:** The query is materialized by either using "ToList()" method or "Execute()" method for query deferred.
58+
59+
## Limitations
60+
61+
- Entity Framework Core:
62+
- **DO NOT** support Cache Query Deferred (May be available when EF Core will be more stable)
63+
64+
## Requirements
65+
66+
- **EF+ Query Cache:** Full version or Standalone version
67+
- **Database Provider:** All supported
68+
- **Entity Framework Version:** EF Core
69+
- **Minimum Framework Version:** .NET Framework 4
70+
71+
## Conclusion
72+
73+
As we have seen, EF+ Query Cache follows a good architecture principle:
74+
75+
- **Flexible:** Tag & Cache Options make it possible to use Query Cache in a various number of scenarios.
76+
- **Extensible:** If there is something missing, the library creates your own extension method or your own cache to overcome the problem.
77+
- **Maintainable:** The easy to use API, documentation and available source code allows new developers to quickly understand this feature.
78+
- **Scalable:** Caching gets only better as the number of user/traffic grows by drastically reducing database round trip.
79+
80+
Need help getting started? [[email protected]](mailto:[email protected])
81+
82+
We welcome all comments, ideas and suggestions to improve our library.

0 commit comments

Comments
 (0)