/// <summary> /// After a "Put" request has been processed and the response basket has ascended to here /// any cached object and collection which is now invalid is removed from the cache /// </summary> /// <param name="basket">A basket</param> /// <param name="visit">The visit the basket is currently making</param> /// <returns>A Task that may be awaited</returns> public Task AscendFromAsync(IPutBasket <TId, T> basket, IVisit visit) { // always remove items from cache on way back up, otherwise another thread // may repopulate the cache before the decent is complete if (basket?.DescentPayload != null) { Cache.RemoveCollection(); Cache.Remove(basket.DescentPayload.Identity); } return(Task.CompletedTask); }
/// <summary> /// No action performed /// </summary> /// <param name="basket">A basket</param> /// <param name="visit">The visit the basket is currently making</param> /// <returns>A Task that may be awaited</returns> public Task DescendToAsync(IPutBasket <TId, T> basket, IVisit visit) { return(Task.CompletedTask); }
public Task AddResultAsync(IPutBasket <int, Frog, int> basket, IVisit visit) { basket.AscentPayload = 1; return(Task.CompletedTask); }
public Task <IPutBasket <int, Frog, int> > SendAsync(IPutBasket <int, Frog, int> basket) { return(new Shaft <IPutBasket <int, Frog, int> >(TerminalLayer) .Add(CacheLayer) .SendAsync(basket)); }
/// <summary> /// Performs no action /// </summary> /// <param name="basket">A basket</param> /// <param name="visit">The visit the basket is currently making</param> /// <returns>A Task that may be awaited</returns> public Task AscendFromAsync(IPutBasket basket, IVisit visit) { return(Task.CompletedTask); }
/// <summary> /// If the user is not allowed to "Put" T's then an UnauthorizedAccessException will be thrown. /// </summary> /// <param name="basket">The request</param> /// <param name="visit">The visit the basket is currently making</param> /// <returns>A Task that may be awaited</returns> public Task DescendToAsync(IPutBasket basket, IVisit visit) { EnsureOperationAllowed(Operations.Put, basket, visit); return(Task.CompletedTask); }