You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This interface must inherit **IEasyCaching** by default. And we need to add `EasyCachingAble`,`EasyCachingPut` and `EasyCachingEvict` to the methods that we want to simplify the caching operation.
23
+
We need to add `EasyCachingAble`,`EasyCachingPut` or `EasyCachingEvict` on the methods that we want to simplify the caching operation.
24
+
25
+
The following unordered list shows you what the attribute will affect the caching.
23
26
24
27
- EasyCachingAble , Read from cached items
25
28
- EasyCachingPut , Update the cached item
26
29
- EasyCachingEvict , Remove one cached item or multi cached items
27
30
31
+
There are some properties that we should know
32
+
33
+
Property | Description | Apply
34
+
---|---|---
35
+
CacheKeyPrefix | To specify the prefix of your cache key | All
36
+
CacheProviderName | To specify which provider you want to use | All
37
+
IsHightAvailability | Whether caching opreation will break your method | All
38
+
Expiration | To specify the expiration of your cache item,the unit is second | EasyCachingAble and EasyCachingPut
39
+
IsAll | Whether remove all the cached items start with the CacheKeyPrefix | EasyCachingEvict only
40
+
IsBefore | Remove the cached item before method excute or after method excute | EasyCachingEvict only
We need to add `EasyCachingAble`,`EasyCachingPut` or `EasyCachingEvict` on the methods that we want to simplify the caching operation.
24
+
25
+
The following unordered list shows you what the attribute will affect the caching.
26
+
27
+
- EasyCachingAble , Read from cached items
28
+
- EasyCachingPut , Update the cached item
29
+
- EasyCachingEvict , Remove one cached item or multi cached items
30
+
31
+
There are some properties that we should know
32
+
33
+
Property | Description | Apply
34
+
---|---|---
35
+
CacheKeyPrefix | To specify the prefix of your cache key | All
36
+
CacheProviderName | To specify which provider you want to use | All
37
+
IsHightAvailability | Whether caching opreation will break your method | All
38
+
Expiration | To specify the expiration of your cache item,the unit is second | EasyCachingAble and EasyCachingPut
39
+
IsAll | Whether remove all the cached items start with the CacheKeyPrefix | EasyCachingEvict only
40
+
IsBefore | Remove the cached item before method excute or after method excute | EasyCachingEvict only
41
+
42
+
Here is a easy sample to show you how to use.
43
+
44
+
Defining a regular interface at first.
24
45
25
46
```csharp
26
47
publicinterfaceIDemoService
27
48
{
49
+
[EasyCachingAble(Expiration=10)]
28
50
stringGetCurrentUtcTime();
29
51
52
+
[EasyCachingPut(CacheKeyPrefix="Castle")]
30
53
stringPutSomething(stringstr);
31
54
55
+
[EasyCachingEvict(IsBefore=true)]
32
56
voidDeleteSomething(intid);
33
57
}
34
58
```
35
59
36
-
This implement must inherit **IEasyCaching** by default. And we need to add `EasyCachingAble`,`EasyCachingPut` and `EasyCachingEvict` to the methods that we want to simplify the caching operation.
37
-
38
-
- EasyCachingAble , Read from cached items
39
-
- EasyCachingPut , Update the cached item
40
-
- EasyCachingEvict , Remove one cached item or multi cached items
0 commit comments