示例#1
0
        public R Invoke(T argument)
        {
            topItems.Hit(argument);
            var key = string.Join(",", this.key, argument.GetKey());

            if (topItems.GetRank().Any(x => x.Id.GetKey().ToString().Equals(argument.GetKey().ToString())) && argument.IsCachable())
            {
                return(cache.AddOrGetExistingOrDefault(
                           key, () =>
                {
                    return this.function.Invoke(argument);
                }, this.CreateCachePolicy()));
            }
            else
            {
                return(this.function.Invoke(argument));
            }
        }