The ItemCacheService is used to manage ItemCache collections such as those in the Basket, Wishlist and SalePreparation objects.
## Instantiating
[block:$textarea] { "text": "The ItemCacheService is exposed through the `MerchelloContext`", "sidebar": true } [/block]ο»Ώ
ο»Ώ
βxvar itemCacheService = MerchelloContext.Current.Services.ItemCacheService;
## Class
ο»Ώ
xxxxxxxxxx
1public class ItemCacheService : MerchelloRepositoryService,
IItemCacheService, IService
## Constructors
Name | Description |
ItemCacheService() | Initializes a new instance of the ItemCacheService class. |
ItemCacheService(ILogger) | Initializes a new instance of the ItemCacheService class. |
ItemCacheService(RepositoryFactory, ILogger) | Initializes a new instance of the ItemCacheService class. |
ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger) | Initializes a new instance of the ItemCacheService class. |
ItemCacheService(IDatabaseUnitOfWorkProvider, RepositoryFactory, ILogger, IEventMessagesFactory) | Initializes a new instance of the ItemCacheService class. |
## Public Methods
Name | Description |
Delete(IItemCache, Boolean) | Deletes a single IItemCache |
Delete(IEnumerable(IItemCache), Boolean) | Deletes a collection IItemCache |
GetAll | Gets all IItemCache |
GetByKey | Gets a list of Basket give a list of unique keys |
Page<IItemCache> GetCustomerItemCachePage(ItemCacheType itemCacheType, DateTime startDate, DateTime endDate, long page, long itemsPerPage, string sortBy = "", SortDirection sortDirection = SortDirection.Descending) | Get a paged collection of customer item caches (Basket and Wishlist contents) |
GetByKeys | Gets a list of Basket give a list of unique keys |
GetItemCacheByCustomer(ICustomerBase) | Returns a collection of item caches for the consumer |
GetItemCacheByCustomer(ICustomerBase, ItemCacheType) | Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist. |
GetItemCacheByCustomer(ICustomerBase, Guid) | Returns the customer item cache of a given type. This method will not create an item cache if the cache does not exist. |
GetItemCacheWithKey(ICustomerBase, ItemCacheType) | Creates a basket for a consumer with a given type |
GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid) | Creates a basket for a consumer with a given type |
GetItemCacheWithKey(ICustomerBase, ItemCacheType, Guid) | Saves a single IItemCache |
Save(IEnumerable(IItemCache), Boolean) | Saves a collection of IItemCache. |
## Events
Name | Description |
Creating | Occurs before create |
Created | Occurs after create |
Deleting | Occurs before delete |
Deleted | Occurs after delete |
Saving | Occurs before save |
Saved | Occurs after save |
## Interface on GitHub
ο»Ώ[https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs](πο»Ώ)ο»Ώ