Update of /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Cache
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv13877
Modified Files:
CacheParameterAdvice.cs CacheResultAdvice.cs
Log Message:
SPRNET-937 - Add additional logging of cache inserts in Cache advice.
Index: CacheParameterAdvice.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Cache/CacheParameterAdvice.cs,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** CacheParameterAdvice.cs 24 Aug 2007 22:43:46 -0000 1.6
--- CacheParameterAdvice.cs 5 May 2008 15:00:55 -0000 1.7
***************
*** 22,25 ****
--- 22,26 ----
using System.Reflection;
+ using Common.Logging;
using Spring.Aop;
using Spring.Caching;
***************
*** 54,58 ****
{
// shared logger instance
! //private static readonly ILog logger = LogManager.GetLogger(typeof(CacheParameterAdvice));
/// <summary>
--- 55,59 ----
{
// shared logger instance
! private static readonly ILog logger = LogManager.GetLogger(typeof(CacheParameterAdvice));
/// <summary>
***************
*** 86,89 ****
--- 87,91 ----
(CacheParameterAttribute[])p.GetCustomAttributes(typeof(CacheParameterAttribute), false);
+ bool isLogDebugEnabled = logger.IsDebugEnabled;
foreach (CacheParameterAttribute paramInfo in paramInfoArray)
{
***************
*** 95,99 ****
--- 97,108 ----
"] does not exist.");
object key = paramInfo.KeyExpression.GetValue(arguments[i]);
+ #region Instrumentation
+ if (isLogDebugEnabled)
+ {
+ logger.Debug("Caching parameter for key [" + key + "].");
+ }
+
+ #endregion
cache.Insert(key, arguments[i], paramInfo.TimeToLiveTimeSpan);
}
Index: CacheResultAdvice.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/src/Spring/Spring.Aop/Aspects/Cache/CacheResultAdvice.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** CacheResultAdvice.cs 24 Aug 2007 22:43:46 -0000 1.5
--- CacheResultAdvice.cs 5 May 2008 15:00:55 -0000 1.6
***************
*** 152,155 ****
--- 152,163 ----
if (EvalCondition(resultInfo.Condition, resultInfo.ConditionExpression, returnValue, vars))
{
+ #region Instrumentation
+
+ if (isLogDebugEnabled)
+ {
+ logger.Debug("Caching object for key [" + resultKey + "].");
+ }
+
+ #endregion
cache.Insert(resultKey, (returnValue==null)?NullValue:returnValue, resultInfo.TimeToLiveTimeSpan);
}
***************
*** 192,195 ****
--- 200,204 ----
"] does not exist.");
+ bool isDebugEnabled = logger.IsDebugEnabled;
foreach (object item in items)
{
***************
*** 197,200 ****
--- 206,217 ----
{
object itemKey = itemInfo.KeyExpression.GetValue(item);
+ #region Instrumentation
+
+ if (isDebugEnabled)
+ {
+ logger.Debug("Caching collection item for key [" + itemKey + "].");
+ }
+
+ #endregion
cache.Insert(itemKey, (item==null?NullValue:item), itemInfo.TimeToLiveTimeSpan);
}
|