Exemple #1
0
        public override void Init(CallMethodInfo info, string configString)
        {
            base.Init(info, configString);

            info.CacheAspect = this;

            _methodInfo = info.MethodInfo;

            var ps = configString.Split(';');

            foreach (var p in ps)
            {
                var vs = p.Split('=');

                if (vs.Length == 2)
                {
                    switch (vs[0].ToLower().Trim())
                    {
                    case "maxcachetime": _instanceMaxCacheTime = int.Parse(vs[1].Trim()); break;

                    case "isweak":       _instanceIsWeak = bool.Parse(vs[1].Trim()); break;
                    }
                }
            }
        }
Exemple #2
0
		public override void Init(CallMethodInfo info, string configString)
		{
 			base.Init(info, configString);

			info.CacheAspect = this;

			_methodInfo = info.MethodInfo;

			CacheSyncRoot = info.SyncRoot;

			_cache = CreateCache();

			var ps = configString.Split(';');

			foreach (var p in ps)
			{
				var vs = p.Split('=');

				if (vs.Length == 2)
				{
					switch (vs[0].ToLower().Trim())
					{
						case "maxcachetime": _instanceMaxCacheTime = int. Parse(vs[1].Trim()); break;
						case "isweak":       _instanceIsWeak       = bool.Parse(vs[1].Trim()); break;
					}
				}
			}
		}
Exemple #3
0
        /// <summary>
        /// Clear a method call cache.
        /// </summary>
        /// <param name="methodInfo">The <see cref="MethodInfo"/> representing cached method.</param>
        public static void ClearCache(MethodInfo methodInfo)
        {
            if (methodInfo == null)
            {
                throw new ArgumentNullException("methodInfo");
            }

            FieldInfo[] fields = methodInfo.DeclaringType.GetFields(BindingFlags.NonPublic | BindingFlags.Static);

            foreach (FieldInfo fieldInfo in fields)
            {
                if (fieldInfo.FieldType != typeof(CallMethodInfo))
                {
                    continue;
                }

                CallMethodInfo cmi = (CallMethodInfo)fieldInfo.GetValue(null);

                if (cmi != null && cmi.MethodInfo == methodInfo)
                {
                    CleanupThread.ClearCache(cmi.MethodCallCache);
                    break;
                }
            }
        }
Exemple #4
0
        public override void Init(CallMethodInfo info, string configString)
        {
            base.Init(info, configString);

            string[] ps = configString.Split(';');

            foreach (string p in ps)
            {
                string[] vs = p.Split('=');

                if (vs.Length == 2)
                {
                    switch (vs[0].ToLower().Trim())
                    {
                    case "filename":      _instanceFileName = vs[1].Trim();  break;

                    case "mincalltime":   _instanceMinCallTime = int.Parse(vs[1].Trim()); break;

                    case "logexceptions": _instanceLogExceptions = bool.Parse(vs[1].Trim()); break;

                    case "logparameters": _instanceLogParameters = bool.Parse(vs[1].Trim()); break;
                    }
                }
            }
        }
		public override void Init(CallMethodInfo info, string configString)
		{
			base.Init(info, configString);

			string[] ps = configString.Split(';');

			foreach (string p in ps)
			{
				string[] vs = p.Split('=');

				if (vs.Length == 2)
				{
					switch (vs[0].ToLower().Trim())
					{
						case "filename":      _instanceFileName      =            vs[1].Trim();  break;
						case "mincalltime":   _instanceMinCallTime   = int. Parse(vs[1].Trim()); break;
						case "logexceptions": _instanceLogExceptions = bool.Parse(vs[1].Trim()); break;
						case "logparameters": _instanceLogParameters = bool.Parse(vs[1].Trim()); break;
					}
				}
			}
		}
Exemple #6
0
        public override void Init(CallMethodInfo info, string configString)
        {
            base.Init(info, configString);

            _counters.Add(_counter = CreateCounter(info) ?? CreateCounterInternal(info));
        }
Exemple #7
0
 private static MethodCallCounter CreateCounterInternal(CallMethodInfo methodInfo)
 {
     return(new MethodCallCounter(methodInfo));
 }
Exemple #8
0
		public override void Init(CallMethodInfo info, string configString)
		{
			base.Init(info, configString);

			_counters.Add(_counter = CreateCounter(info));
		}
Exemple #9
0
		private static MethodCallCounter CreateCounterInternal(CallMethodInfo methodInfo)
		{
			return new MethodCallCounter(methodInfo);
		}
		public MethodCallCounter(CallMethodInfo methodInfo)
		{
			_callMethodInfo = methodInfo;
			_methodInfo     = methodInfo.MethodInfo;
		}
 public MethodCallCounter(CallMethodInfo methodInfo)
 {
     _callMethodInfo = methodInfo;
     _methodInfo     = methodInfo.MethodInfo;
 }
			public void Init(CallMethodInfo info, string configString)
			{
			}