Guides

ItemCacheService

Documentation for Merch's ItemCacheService

The ItemCacheService is used to manage ItemCache collections such as those in the Basket, Wishlist and SalePreparation objects.

Instantiating

The ItemCacheService is exposed through the MerchelloContext

var itemCacheService = MerchelloContext.Current.Services.ItemCacheService;

Class

public class ItemCacheService : MerchelloRepositoryService, 
    IItemCacheService, IService

Constructors

NameDescription
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

NameDescription
Delete(IItemCache, Boolean)Deletes a single IItemCache
Delete(IEnumerable(IItemCache), Boolean)Deletes a collection IItemCache
GetAllGets all IItemCache
GetByKeyGets a list of Basket give a list of unique keys
Page 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)
GetByKeysGets 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

NameDescription
CreatingOccurs before create
CreatedOccurs after create
DeletingOccurs before delete
DeletedOccurs after delete
SavingOccurs before save
SavedOccurs after save

Interface on GitHub

https://github.com/Merchello/Merchello/blob/master/src/Merchello.Core/Services/Interfaces/IItemCacheService.cs