예제 #1
0
        /// <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);
        }
예제 #2
0
 /// <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);
 }
예제 #3
0
        public Task AddResultAsync(IPutBasket <int, Frog, int> basket, IVisit visit)
        {
            basket.AscentPayload = 1;

            return(Task.CompletedTask);
        }
예제 #4
0
 public Task <IPutBasket <int, Frog, int> > SendAsync(IPutBasket <int, Frog, int> basket)
 {
     return(new Shaft <IPutBasket <int, Frog, int> >(TerminalLayer)
            .Add(CacheLayer)
            .SendAsync(basket));
 }
예제 #5
0
 /// <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);
 }
예제 #6
0
 /// <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);
 }