Пример #1
0
        public void CacheResponse()
        {
            AddHeuristicsEventArgs eventArgs = new AddHeuristicsEventArgs
            {
                Channel        = Channel,
                MethodInfo     = MethodInfo,
                Parameters     = Parameters,
                MethodResponse = MethodResponse
            };

            _events.OnAddToHeuristics(eventArgs);
        }
        private void _events_AddToHeuristics(object sender, AddHeuristicsEventArgs e)
        {
            EnableCacheAttribute cache   = e.MethodInfo.GetCustomAttribute <EnableCacheAttribute>();
            HeuristicsInfo       addInfo = new HeuristicsInfo
            {
                Channel        = e.Channel,
                ChannelMethod  = e.MethodInfo,
                MethodResponse = e.MethodResponse,
                AddedTime      = DateTime.Now,
                Parameters     = e.Parameters,
                Duration       = cache.Duration,
                DurationUnit   = cache.Unit
            };

            _cachedInfos.Add(addInfo);
        }
Пример #3
0
 public void OnAddToHeuristics(AddHeuristicsEventArgs args)
 {
     AddToHeuristics?.Invoke(this, args);
 }