diff --git a/docs/en/Entity-Cache.md b/docs/en/Entity-Cache.md index 4ab83c9a01..d0e5fcc06b 100644 --- a/docs/en/Entity-Cache.md +++ b/docs/en/Entity-Cache.md @@ -1,19 +1,19 @@ # Entity Cache -ABP Framework provides **Distributed Entity Caching System** for caching entities. +ABP Framework provides a **Distributed Entity Caching System** for caching entities. You can use this caching mechanism if you want to cache your entity objects automatically and retrieve them from a cache instead of querying it from a database repeatedly. -## How Distributed Entity Caching System Works? +## How Does the Distributed Entity Caching System Work? ABP's Entity Caching System does the following operations on behalf of you: -* It gets the entity from the database (by using the [Repositories](Repositories.md)) in its first call and then gets from the cache in subsequent calls. +* It gets the entity from the database (by using the [Repositories](Repositories.md)) in its first call and then gets it from the cache in subsequent calls. * It automatically invalidates the cached entity if the entity is updated or deleted. Thus, it will be retrieved from the database in the next call and will be re-cached. ## Installation -[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching) is the main package for the ABP's caching system and it's already installed in [the application startup template](Startup-Templates/Index.md). So, you don't need to install it manually. +[Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching) is the main package for ABP's caching system and it's already installed in [the application startup template](Startup-Templates/Index.md). So, you don't need to install it manually. ## Usage @@ -36,7 +36,7 @@ public class Product : AggregateRoot * This example uses the `CacheName` attribute for the `Product` class to set the cache name. By default, the cache class's **FullName** is used for the cache name. -If you want to cache this entity, first you should configure the [dependency injection](Dependency-Injection.md) to register the `IEntityCache` service in the `ConfigureServices` method of your [module class](Module-Development-Basics.md): +If you want to cache this entity, you should first configure the [dependency injection](Dependency-Injection.md) to register the `IEntityCache` service in the `ConfigureServices` method of your [module class](Module-Development-Basics.md): ```csharp context.Services.AddEntityCache(); @@ -78,9 +78,9 @@ public class ProductAppService : ApplicationService, IProductAppService * Here, we've directly cached the `Product` entity. In that case, the `Product` class must be serializable. Sometimes this might not be possible and you may want to use another class to store the cache data. For example, we may want to use the `ProductDto` class instead of the `Product` class for the cached object if the `Product` entity is not serializable. -### Caching Cache Item Classes +### Caching the Cache Item Classes -`IEntityCache` service can be used for caching other cache item classes if the entity is not serializable. +The `IEntityCache` service can be used for caching other cache item classes if the entity is not serializable. **Example: `ProductDto` class** @@ -154,7 +154,7 @@ public override void ConfigureServices(ServiceConfigurationContext context) } ``` -* You can register entity cache by using the `context.Services.AddEntityCache()` method for directly cache the entity object. +* You can register the entity cache by using the `context.Services.AddEntityCache()` method to directly cache the entity object. * Or alternatively, you can use the `context.Services.AddEntityCache()` method to configure entities that are mapped to a cache item. ### Caching Options @@ -176,8 +176,8 @@ context.Services.AddEntityCache( * Entity classes should be serializable/deserializable to/from JSON to be cached (because it's serialized to JSON when saving in the [Distributed Cache](Caching.md)). If your entity class is not serializable, you can consider using a cache-item/DTO class instead, as mentioned in the *Usage* section above. * Entity Caching System is designed as **read-only**. So, you shouldn't make changes to the same entity when you use the entity cache. Instead, you should always read it from the database to ensure transactional consistency. -* Entity Caching System uses the cache class's **FullName** as the cache name by default. You can use the `CacheName` attribute on the cache item class to set the cache name. +* The Entity Caching System uses the cache class's **FullName** as the cache name by default. You can use the `CacheName` attribute on the cache item class to set the cache name. ## See Also -* [Caching](Caching.md) \ No newline at end of file +* [Caching](Caching.md)