Skip to content

Commit 2fee58b

Browse files
committed
Caching
1 parent 66e91a0 commit 2fee58b

File tree

1 file changed

+22
-13
lines changed

1 file changed

+22
-13
lines changed

metalama-awareness-campaign/04_caching.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
21
Hello!
32

4-
It's Fedja from Metalama again. In my previous emails, I described Metalama as a ,meta-programming _framework_ that allows you to generate and validate code as you type.
3+
It's Fedja from Metalama again. In my previous emails, I described Metalama as a meta-programming _framework_ that allows you to generate and validate code as you type.
54

65
If you looked at our API and documentation, you may have got the impression that the framework is deep and complex.
76

@@ -18,33 +17,33 @@ You can add caching to your app in just three steps:
1817
1. Add the [Metalama.Patterns.Caching.Aspects](https://www.nuget.org/packages/Metalama.Patterns.Caching.Aspects/) package to your project.
1918
2. Navigate to all methods that need caching and add the `[Cache]` custom attribute.
2019

21-
20+
2221
```c#
2322
using Metalama.Patterns.Caching.Aspects;
24-
23+
2524
namespace CreatingAspects.Caching
2625
{
2726
public sealed class CloudCalculator
2827
{
29-
28+
3029
[Cache]
3130
public int Add(int a, int b)
3231
{
3332
Console.WriteLine("Doing some very hard work.");
34-
33+
3534
this.OperationCount++;
36-
35+
3736
Console.WriteLine("Finished doing some very hard work.");
38-
37+
3938
return a + b;
4039
}
41-
40+
4241
public int OperationCount { get; private set; }
4342
}
4443
}
4544
```
4645

47-
3. Go to the application startup code and call `AddMetalamaCaching`. This adds the `ICachingService` interface to your `IServiceCollection`, enabling the `[Cache]` aspect to be used on all objects instantiated by the DI container.
46+
3. Go to the application startup code and call `AddMetalamaCaching`. This adds the `ICachingService` interface to your `IServiceCollection`, enabling the `[Cache]` aspect to be used on all objects instantiated by the DI container.
4847

4948
```c#
5049
builder.Services.AddMetalamaCaching();
@@ -62,7 +61,6 @@ You can add caching to your app in just three steps:
6261
builder.Services.AddMetalamaCaching(
6362
caching => caching.WithBackend(
6463
backend => backend.Redis().WithL1() ) );
65-
6664
```
6765

6866
## What Metalama does for you
@@ -83,8 +81,19 @@ Other features of this open-source caching library include:
8381

8482
## Conclusion
8583

86-
Applying caching to an application can dramatically improve performance, but implementing the pattern is not straightforward. Metalama does all the heavy lifting for you and provides several flexible implementations that you can customize to meet your specific requirements.
84+
Applying caching to an application can dramatically improve performance, but implementing the pattern by hand is not straightforward. Metalama does all the heavy lifting for you and provides several flexible implementations that you can customize to meet your specific requirements.
8785

8886
By leveraging Metalama, you'll find that implementing caching is both simpler and more efficient than creating a bespoke solution.
8987

90-
Caching is just one of the open-source aspects built by our team. For more, check [Metalama Marketplace](https://www.postsharp.net/metalama/marketplace).
88+
Caching is just one of the open-source aspects built by our team. For more, check [Metalama Marketplace](https://www.postsharp.net/metalama/marketplace).
89+
90+
91+
Our development team is looking forward to your feedback and questions on our [Slack community workspace](https://www.postsharp.net/slack). Of course, you can also answer this email and I’ll make sure it will reach an engineer.
92+
93+
Thank you!
94+
95+
All the best,
96+
Fedja
97+
Community Manager
98+
99+
*P.S. We will send you 2 more emails about Metalama and then stop. You can unsubscribe at any time.*

0 commit comments

Comments
 (0)