From c8d1d775a8ce847673a8c6eab44069a0df1d01ff Mon Sep 17 00:00:00 2001 From: Alex Yakunin Date: Mon, 30 Oct 2023 02:40:24 -0700 Subject: [PATCH] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 96b642983..729486375 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ And the best part is: **Fusion does it does all of that transparently for you,** - Register such service via `serviceCollection.AddFusion().AddService()` - Resolve it as usual - i.e. pass them as dependencies, use `serviceProvider.GetRequiredService()`, etc. - Use `using (Computed.Invalidate()) { ... }` block to invalidate a result of a certain call (and thus all of its dependencies) or a set of them. Here is how it looks like: - ``` + ```cs var avatars = await GetUserAvatars(userId); using (Computed.Invalidate()) { // Any call to "compute method" inside this block invalidates @@ -60,7 +60,7 @@ And if you think about this, *any cached & still consistent result is as good as > "Hey, I'm smart enough to tell when any data I give you gets changed. So please don't bother me with the repeating calls requesting the same data unless I told you it's changed." Finally, such clients act as "regular" Fusion services - the results they produce are also backed by [computed values], so they extend the local dependency graph the same way. Look at this code: -``` +```cs string GetUserName(id) => (await userService.GetUser(id)).Name; ```