From 5dfe8519d0bfa355d74b02989370e4ad4074bd9a Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Mon, 1 Feb 2021 15:37:03 +0800 Subject: [PATCH] Update cache document --- docs/en/Caching.md | 7 +++++-- docs/zh-Hans/Caching.md | 12 ++++++++++++ docs/zh-Hans/Redis-Cache.md | 1 + .../Volo/Abp/Caching/IDistributedCache.cs | 4 ++-- 4 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 docs/zh-Hans/Redis-Cache.md diff --git a/docs/en/Caching.md b/docs/en/Caching.md index 042f13ffe0..7dbf02d875 100644 --- a/docs/en/Caching.md +++ b/docs/en/Caching.md @@ -242,12 +242,15 @@ In addition, all of the `IDistributedCache` (and `IDistributedCache< ## Batch Operations -ABP's distributed cache interfaces provide methods to perform batch get/set methods those improves the performance when you want to get or set multiple cache items in a single method call. +ABP's distributed cache interfaces provide methods to perform batch methods those improves the performance when you want to batch operation multiple cache items in a single method call. * `SetManyAsync` and `SetMany` methods can be used to set multiple values to the cache. * `GetManyAsync` and `GetMany` methods can be used to retrieve multiple values from the cache. +* `GetOrAddManyAsync` and `GetOrAddMany` methods can be used to retrieve multiple values and set missing values from the cache +* `RefreshManyAsync` and `RefreshMany` methods can be used to resets the sliding expiration timeout of multiple values from the cache +* `RemoveManyAsync` and `RemoveMany` methods can be used to remove multiple values from the cache -> These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](Redis-Cache.md). If the provider doesn't support, it fallbacks to `SetAsync` and `GetAsync` methods (called once for each item). +> These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](Redis-Cache.md). If the provider doesn't support, it fallbacks to `SetAsync` and `GetAsync` ... methods (called once for each item). ## Advanced Topics diff --git a/docs/zh-Hans/Caching.md b/docs/zh-Hans/Caching.md index 0557ddcb4d..a75199ce47 100644 --- a/docs/zh-Hans/Caching.md +++ b/docs/zh-Hans/Caching.md @@ -192,6 +192,18 @@ public class BookService : ITransientDependency } ```` +## 批量操作 + +ABP的分布式缓存接口定义了以下批量操作方法,当你需要在一个方法中调用多次缓存操作时,这些方法可以提高性能 + +* `SetManyAsync` 和 `SetMany` 方法可以用来设置多个值. +* `GetManyAsync` 和 `GetMany` 方法可以用来从缓存中获取多个值. +* `GetOrAddManyAsync` 和 `GetOrAddMany` 方法可以用来从缓存中获取并添加缺少的值. +* `RefreshManyAsync` 和 `RefreshMany` 方法可以来用重置多个值的滚动过期时间. +* `RemoveManyAsync` 和 `RemoveMany` 方法呆以用来删除多个值. + +> 这些不是标准的ASP.NET Core缓存方法, 所以某些提供程序可能不支持. [ABP Redis集成包](Redis-Cache.md)实现了它们. 如果提供程序不支持,会回退到 `SetAsync` 和 `GetAsync` ... 方法(循环调用). + ### DistributedCacheOptions TODO \ No newline at end of file diff --git a/docs/zh-Hans/Redis-Cache.md b/docs/zh-Hans/Redis-Cache.md new file mode 100644 index 0000000000..cb82a640d5 --- /dev/null +++ b/docs/zh-Hans/Redis-Cache.md @@ -0,0 +1 @@ +TODO... \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs index 3806276969..f8e76fd9dd 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/IDistributedCache.cs @@ -258,7 +258,7 @@ namespace Volo.Abp.Caching ); /// - /// Refreshes multiple cache items. + /// Refreshes the cache value of the given keys, and resets their sliding expiration timeout. /// Based on the implementation, this can be more efficient than setting multiple items individually. /// /// The keys of cached items to be retrieved from the cache. @@ -268,7 +268,7 @@ namespace Volo.Abp.Caching bool? hideErrors = null); /// - /// Refreshes multiple cache items. + /// Refreshes the cache value of the given keys, and resets their sliding expiration timeout. /// Based on the implementation, this can be more efficient than setting multiple items individually. /// /// The keys of cached items to be retrieved from the cache.