Exemplo n.º 1
0
    protected virtual async Task SetPreOrderCacheAsync(FlashSalePlanCacheItem plan, ProductDto product, ProductSkuDto productSku, DateTimeOffset expirationTime)
    {
        var hashToken = await FlashSalePlanHasher.HashAsync(plan.LastModificationTime, product.LastModificationTime, productSku.LastModificationTime);

        await PreOrderDistributedCache.SetAsync(await GetPreOrderCacheKeyAsync(plan.Id), new FlashSalePlanPreOrderCacheItem()
        {
            HashToken             = hashToken,
            PlanId                = plan.Id,
            ProductId             = product.Id,
            ProductSkuId          = productSku.Id,
            InventoryProviderName = product.InventoryProviderName,
        }, new DistributedCacheEntryOptions()
        {
            AbsoluteExpiration = expirationTime
        });
    }
Exemplo n.º 2
0
 protected virtual async Task RemovePreOrderCacheAsync(Guid planId)
 {
     await PreOrderDistributedCache.RemoveAsync(await GetPreOrderCacheKeyAsync(planId));
 }
Exemplo n.º 3
0
 protected virtual async Task <FlashSalePlanPreOrderCacheItem> GetPreOrderCacheAsync(Guid planId)
 {
     return(await PreOrderDistributedCache.GetAsync(await GetPreOrderCacheKeyAsync(planId)));
 }