Skip to content

Commit 49c5894

Browse files
authored
Update ef6-query-cache.md
1 parent 4bdc3a3 commit 49c5894

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

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

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,49 @@ var countries1 = ctx.Countries.FromCache().ToList();
2929
var countries2 = ctx.Countries.FromCache().ToList();
3030

3131
```
32-
[Try it in EF6](https://dotnetfiddle.net/nx9A2H) | [Try it in EF Core](https://dotnetfiddle.net/EZZkhP)
32+
[Try it](https://dotnetfiddle.net/nx9A2H)
33+
34+
## Scenarios
35+
36+
- [Query Criteria](scenarios/ef6-query-cache-using-query-criteria.md)
37+
- [Query Deferred](scenarios/ef6-query-cache-query-deferred.md)
38+
- [Tag & ExpireTag](scenarios/ef6-query-cache-tag.md)
39+
- [Expiration](scenarios/ef6-query-cache-expiration.md)
40+
- [Query Cache Control](scenarios/ef6-query-cache-control.md)
41+
42+
## Real Life Scenarios
43+
44+
- Caching read-only data like application configuration.
45+
- Caching data that can 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+
## Requirements
60+
61+
- **EF+ Query Cache:** Full version or Standalone version
62+
- **Database Provider:** All supported
63+
- **Entity Framework Version:** EF5, EF6
64+
- **Minimum Framework Version:** .NET Framework 4
65+
66+
## Conclusion
67+
68+
As we have seen, EF+ Query Cache follows a good architecture principle:
69+
70+
- **Flexible:** Tag & Cache Options make it possible to use Query Cache in a various number of scenarios.
71+
- **Extensible:** If there is something missing, the library creates your own extension method or your own cache to overcome the problem.
72+
- **Maintainable:** The easy to use API, documentation and available source code allows new developers to quickly understand this feature.
73+
- **Scalable:** Caching gets only better as the number of user/traffic grows by drastically reducing database round trip.
74+
75+
Need help getting started? [[email protected]](mailto:[email protected])
76+
77+
We welcome all comments, ideas and suggestions to improve our library.

0 commit comments

Comments
 (0)