You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ibatis.apache.org by gb...@apache.org on 2008/06/19 20:38:39 UTC

svn commit: r669636 [2/2] - in /ibatis/trunk/cs/V3/src: Apache.Ibatis.Common/Configuration/ Apache.Ibatis.Common/Utilities/TypesResolver/ Apache.Ibatis.DataMapper.SqlClient.Test.2005/ Apache.Ibatis.DataMapper.SqlClient.Test.2005/Fixtures/ Apache.Ibatis...

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,171 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+using System.Reflection;
+using Apache.Ibatis.Common.Logging;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Decorators
+{
+    /// <summary>
+    /// A cache decorator that logs all cache access
+    /// </summary>
+    public sealed class LoggingCache : BaseCache
+    {
+        private static readonly ILog logger = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+        private readonly ICache delegateCache = null;
+        private int requests = 0;
+        private int hits = 0;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="LoggingCache"/> class.
+        /// </summary>
+        /// <param name="delegateCache">The delegate cache.</param>
+        public LoggingCache(ICache delegateCache)
+        {
+            this.delegateCache = delegateCache;
+
+            requests = 0;
+            hits = 0;
+        }
+
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        public override string Id
+        {
+            get { return delegateCache.Id; }
+            set { delegateCache.Id = value;}
+        }
+
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return delegateCache.Size; }
+        }
+
+
+        /// <summary>
+        /// Adds an item with the specified key and value into cached data.
+        /// Gets a cached object with the specified key.
+        /// </summary>
+        /// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+        {
+            get
+            {
+                requests++;
+                if (ContainsKey(key))
+                {
+                    hits++;
+                }
+                object value =  delegateCache[key];
+
+                if (logger.IsDebugEnabled)
+                {
+                    if (value != null)
+                    {
+                        logger.Debug(String.Format("Retrieved cached object '{0}' using key '{1}' ", value, key));
+                    }
+                    else
+                    {
+                        logger.Debug(String.Format("Cache miss using key '{0}' ", key));
+                    }
+                    logger.Debug("Cache Hit Ratio [" + Id + "]: " + HitRatio);
+                }
+                return value;
+            }
+            set
+            {
+                if (logger.IsDebugEnabled)
+                {
+                    logger.Debug(String.Format("Cache object '{0}' using key '{1}' ", value, key));
+                }
+
+                delegateCache[key] = value;
+            }
+        }
+
+        /// <summary>
+        /// Remove an object from a cache model
+        /// </summary>
+        /// <param name="key">the key to the object</param>
+        /// <returns>the removed object(?)</returns>
+        public override object Remove(object key)
+        {
+            return delegateCache.Remove(key);
+        }
+
+        /// <summary>
+        /// Clears all elements from the cache.
+        /// </summary>
+        public override void Clear()
+        {
+            if (logger.IsDebugEnabled)
+            {
+                logger.Debug("Clears cache :" + id);
+            }
+
+            delegateCache.Clear();
+        }
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            return delegateCache.ContainsKey(key);
+        }
+
+        /// <summary>
+        /// Gets the hit ratio.
+        /// </summary>
+        /// <value>The hit ratio.</value>
+        public double HitRatio
+        {
+            get
+            {
+                if (requests != 0)
+                {
+                    return (double)hits / (double)requests;
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+        }
+    }
+}

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/LoggingCache.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,112 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Decorators
+{
+    /// <summary>
+    /// Cache decorator which deals with null value
+    /// </summary>
+    public sealed class NullValueDecorator : BaseCache 
+    {
+        private readonly ICache delegateCache = null;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="NullValueDecorator"/> class.
+        /// </summary>
+        /// <param name="delegateCache">The delegate cache.</param>
+        public NullValueDecorator(ICache delegateCache)
+        {
+            this.delegateCache = delegateCache;
+        }
+
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        public override string Id
+        {
+            get { return delegateCache.Id; }
+            set { delegateCache.Id = value; }
+        }
+
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return delegateCache.Size; }
+        }
+
+        /// <summary>
+        /// Adds an item with the specified key and value into cached data.
+        /// Gets a cached object with the specified key.
+        /// </summary>
+        /// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+        {
+            get { return delegateCache[key];  }
+            set
+            {
+                if (null == value) { value = CacheModel.NULL_OBJECT; }
+                delegateCache[key] = value; ;
+            }
+        }
+
+        /// <summary>
+        /// Remove an object from a cache model
+        /// </summary>
+        /// <param name="key">the key to the object</param>
+        /// <returns>the removed object(?)</returns>
+        public override object Remove(object key)
+        {
+            return delegateCache.Remove(key);
+        }
+
+        /// <summary>
+        /// Clears all elements from the cache.
+        /// </summary>
+        public override void Clear()
+        {
+            delegateCache.Clear();
+        }
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            return delegateCache.ContainsKey(key);
+        }
+    }
+}

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/NullValueDecorator.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,152 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Decorators
+{
+    /// <summary>
+    /// Cache decorator which clears the delegate cache on interval
+    /// </summary>
+    public sealed class ScheduledCache : BaseCache 
+    {
+        private readonly long flushInterval = 0;
+        private long lastClear = 0;
+        private readonly ICache delegateCache = null;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="ScheduledCache"/> class.
+        /// </summary>
+        /// <param name="delegateCache">The delegate cache.</param>
+        /// <param name="flushIntervalInMinute">The flush interval in minute.</param>
+        public ScheduledCache(ICache delegateCache, long flushIntervalInMinute)
+        {
+            this.delegateCache = delegateCache;
+            flushInterval = flushIntervalInMinute * TimeSpan.TicksPerMinute;
+            lastClear = DateTime.Now.Ticks;
+        }
+
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        public override string Id
+        {
+            get { return delegateCache.Id; }
+        }
+
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get
+            {
+                ClearWhenStale();
+                return delegateCache.Size;
+            }
+            set { delegateCache.Size = value; }
+        }
+
+        /// <summary>
+        /// Adds an item with the specified key and value into cached data.
+        /// Gets a cached object with the specified key.
+        /// </summary>
+        /// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+        {
+            get
+            {
+                if (ClearWhenStale()) 
+                {
+                    return null;
+                } 
+                else 
+                {
+                    return delegateCache[key];
+                }           
+            }
+            set
+            {
+                ClearWhenStale();
+                delegateCache[key] = value;
+            }
+        }
+
+        /// <summary>
+        /// Remove an object from a cache model
+        /// </summary>
+        /// <param name="key">the key to the object</param>
+        /// <returns>the removed object(?)</returns>
+        public override object Remove(object key)
+        {
+            ClearWhenStale();
+            return delegateCache.Remove(key);
+        }
+
+        /// <summary>
+        /// Clears all elements from the cache.
+        /// </summary>
+        public override void Clear()
+        {
+            lastClear = DateTime.Now.Ticks;
+            delegateCache.Clear();
+        }
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            if (ClearWhenStale())
+            {
+                return false;
+            }
+            else
+            {
+                return delegateCache.ContainsKey(key);
+            }
+        }
+
+
+        private bool ClearWhenStale()
+        {
+            if ((DateTime.Now.Ticks - lastClear) > flushInterval)
+            {
+                Clear();
+                return true;
+            }
+            return false;
+        }
+
+    }
+}

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/ScheduledCache.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,154 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using Apache.Ibatis.DataMapper.Exceptions;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Decorators
+{
+    /// <summary>
+    /// Cache decorator that uses serialization to return different instances (copies) of 
+    /// the cached object to each session.
+    /// Therefore each session can safely modify the instance returned.
+    /// </summary>
+    /// <remarks>
+    /// eq. to SHARED_READ_WRITE
+    /// </remarks>
+    public sealed class SharedCache : BaseCache
+    {
+
+        private readonly ICache delegateCache = null;
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SharedCache"/> class.
+        /// </summary>
+        /// <param name="delegateCache">The delegate cache.</param>
+        public SharedCache(ICache delegateCache)
+        {
+            this.delegateCache = delegateCache;
+        }
+
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        public override string Id
+        {
+            get { return delegateCache.Id; }
+            set { delegateCache.Id = value; }
+        }
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return delegateCache.Size; }
+        }
+
+        /// <summary>
+        /// Adds an item with the specified key and value into cached data.
+        /// Gets a cached object with the specified key.
+        /// </summary>
+        /// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+        {
+            get
+            {
+                object value = delegateCache[key];
+
+                if ((value != CacheModel.NULL_OBJECT && value != null) && value.GetType().IsSerializable)
+                {
+                    try
+                    {
+                        MemoryStream stream = new MemoryStream((byte[])value);
+                        stream.Position = 0;
+                        BinaryFormatter formatter = new BinaryFormatter();
+                        value = formatter.Deserialize(stream);
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new DataMapperException("Error caching serializable object.  Be sure you're not attempting to use " +
+                            "a serialized cache for an object that may be taking advantage of lazy loading.  Cause: " + ex.Message, ex);
+                    }
+                }
+                return value;
+            }
+            set
+            {
+                if (value != CacheModel.NULL_OBJECT && value.GetType().IsSerializable)
+                {
+                    try
+                    {
+                        MemoryStream stream = new MemoryStream();
+                        BinaryFormatter formatter = new BinaryFormatter();
+                        formatter.Serialize(stream, value);
+                        value = stream.ToArray();
+                    }
+                    catch (Exception ex)
+                    {
+                        throw new DataMapperException("Error caching serializable object. Cause: " + ex.Message, ex);
+                    }
+                }
+                delegateCache[key] = value;
+            }
+        }
+
+        /// <summary>
+        /// Remove an object from a cache model
+        /// </summary>
+        /// <param name="key">the key to the object</param>
+        /// <returns>the removed object(?)</returns>
+        public override object Remove(object key)
+        {
+            return delegateCache.Remove(key);
+        }
+
+        /// <summary>
+        /// Clears all elements from the cache.
+        /// </summary>
+        public override void Clear()
+        {
+            delegateCache.Clear();
+        }
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            return delegateCache.ContainsKey(key);
+        }
+
+    }
+}

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SharedCache.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,136 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System.Runtime.CompilerServices;
+using Apache.Ibatis.DataMapper.Model.Cache;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Decorators
+{
+    /// <summary>
+    /// Cache decorator specifying that each cache method of the delegate cache can only 
+    /// be executed by only one thread at a time.
+    /// </summary>
+    public sealed class SynchronizedCache :BaseCache 
+    {
+        private readonly ICache delegateCache = null;
+        private readonly object syncLock = new object();
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="SynchronizedCache"/> class.
+        /// </summary>
+        /// <param name="delegateCache">The delegate cache.</param>
+        public SynchronizedCache(ICache delegateCache) {
+            this.delegateCache = delegateCache;
+        }
+
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        public override string Id
+        {
+            get { return delegateCache.Id; }
+            set { delegateCache.Id = value; }
+        }
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return delegateCache.Size; }
+        }
+
+        /// <summary>
+        /// Adds an item with the specified key and value into cached data.
+        /// Gets a cached object with the specified key.
+        /// </summary>
+        /// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+        {
+            [MethodImpl(MethodImplOptions.Synchronized)]
+            get
+            {
+                lock (syncLock)
+                {
+                    return delegateCache[key];
+                }
+            }
+            [MethodImpl(MethodImplOptions.Synchronized)]
+            set
+            {
+                lock (syncLock)
+                {
+                    delegateCache[key] = value;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Remove an object from a cache model
+        /// </summary>
+        /// <param name="key">the key to the object</param>
+        /// <returns>the removed object(?)</returns>
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public override object Remove(object key)
+        {
+            lock (syncLock)
+            {
+                return delegateCache.Remove(key);
+            }
+        }
+
+        /// <summary>
+        /// Clears all elements from the cache.
+        /// </summary>
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public override void Clear()
+        {
+            lock (syncLock)
+            {
+                delegateCache.Clear();
+            }
+        }
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.Synchronized)]
+        public override bool ContainsKey(object key)
+        {
+            lock (syncLock)
+            {
+                return delegateCache.ContainsKey(key);
+            }
+        }
+
+    }
+}

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Decorators/SynchronizedCache.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Copied: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICache.cs (from r666256, ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICacheController.cs)
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICache.cs?p2=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICache.cs&p1=ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICacheController.cs&r1=666256&r2=669636&rev=669636&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICacheController.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/ICache.cs Thu Jun 19 11:38:37 2008
@@ -24,33 +24,34 @@
  ********************************************************************************/
 #endregion
 
-#region Imports
 using System;
-using System.Collections;
-using System.Collections.Specialized;
-#endregion
+using System.Collections.Generic;
 
 namespace Apache.Ibatis.DataMapper.Model.Cache
 {
 	/// <summary>
-	/// Summary description for ICacheController.
+	/// Summary description for ICache.
 	/// </summary>
-	public interface ICacheController
+	public interface ICache
 	{
-		#region Properties
+        /// <summary>
+        /// Gets the id.
+        /// </summary>
+        /// <value>The id.</value>
+        string Id { get; set;}
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        int Size { get; set;}
+
 		/// <summary>
 		/// Adds an item with the specified key and value into cached data.
 		/// Gets a cached object with the specified key.
 		/// </summary>
 		/// <value>The cached object or <c>null</c></value>
-		object this [object key] 
-		{
-			get;
-			set;
-		}
-		#endregion
-
-		#region Methods
+		object this [object key] {get;set;}
 	
 		/// <summary>
 		/// Remove an object from a cache model
@@ -62,14 +63,16 @@
 		/// <summary>
 		/// Clears all elements from the cache.
 		/// </summary>
-		void Flush ();
+        void Clear();
 
-		/// <summary>
-		/// Configures the CacheController
-		/// </summary>
-		/// <param name="properties"></param>
-		void Configure(IDictionary properties);
-		#endregion
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        bool ContainsKey(Object key);
 
 	}
 }

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/FifoCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/FifoCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/FifoCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/FifoCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,124 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date: 2008-05-18 10:02:28 +0200 (dim., 18 mai 2008) $
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System.Collections.Generic;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Implementation
+{
+	/// <summary>
+    /// Cache following a FIFO (first in, first out) algorithm
+	/// </summary>
+	public sealed class FifoCache : BaseCache
+	{
+		private readonly IDictionary<object, object> cache = new Dictionary<object, object>();
+		private readonly LinkedList<object> keyList = new LinkedList<object>();
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="FifoCache"/> class.
+        /// </summary>
+        public FifoCache()
+        {
+            size = 256;
+            cache = new Dictionary<object, object>();
+            keyList = new LinkedList<object>();
+        }
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            set { size = value; }
+        }
+
+		/// <summary>
+		/// Remove an object from a cache model
+		/// </summary>
+		/// <param name="key">the key to the object</param>
+		/// <returns>the removed object</returns>
+		public override object Remove(object key)
+		{
+            object value = null;
+            if (cache.TryGetValue(key, out value))
+            {
+                keyList.Remove(key);
+                cache.Remove(key);
+            }
+            return value;
+		}
+
+		/// <summary>
+		/// Clears all elements from the cache.
+		/// </summary>
+        public override void Clear()
+		{
+            keyList.Clear();
+            cache.Clear();
+		}
+
+
+		/// <summary>
+		/// Adds an item with the specified key and value into cached data.
+		/// Gets a cached object with the specified key.
+		/// </summary>
+		/// <value>The cached object or <c>null</c></value>
+		public override object this [object key] 
+		{
+			get
+            {
+                object value = null;
+                cache.TryGetValue(key, out value);
+                return value;
+            }
+			set
+			{
+                cache[key] = value;
+                keyList.AddLast(key);
+                if (keyList.Count > size)
+                {
+                    LinkedListNode<object> oldestKey = keyList.First;
+                    keyList.RemoveFirst();
+                    cache.Remove(oldestKey.Value);
+                }
+			}
+		}
+
+	
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool  ContainsKey(object key)
+        {
+            return keyList.Contains(key);
+        }
+
+    }
+}

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/LruCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/LruCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/LruCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/LruCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,128 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date: 2008-05-18 10:02:28 +0200 (dim., 18 mai 2008) $
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Implementation
+{
+	/// <summary>
+    /// Cache following a LRU (least recently used) algorithm
+	/// </summary>
+	public sealed class LruCache : BaseCache	
+	{
+        private readonly IDictionary<object, object> cache = new Dictionary<object, object>();
+        private readonly LinkedList<object> keyList = new LinkedList<object>();
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="LruCache"/> class.
+        /// </summary>
+		public LruCache() 
+		{
+			size = 256;
+            cache = new Dictionary<object, object>();
+            keyList = new LinkedList<object>();
+		}
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            set { size =value; }
+        }
+
+		/// <summary>
+		/// Remove an object from a cache model
+		/// </summary>
+		/// <param name="key">the key to the object</param>
+		/// <returns>the removed object(?)</returns>
+		public override object Remove(object key)
+		{
+            object value = null;
+            if (cache.TryGetValue(key, out value))
+            {
+                keyList.Remove(key);
+                cache.Remove(key);
+            }
+            return value;
+		}
+
+		/// <summary>
+		/// Clears all elements from the cache.
+		/// </summary>
+        public override void Clear()
+		{
+            cache.Clear();
+            keyList.Clear();
+		}
+
+
+		/// <summary>
+		/// Adds an item with the specified key and value into cached data.
+		/// Gets a cached object with the specified key.
+		/// </summary>
+		/// <value>The cached object or <c>null</c></value>
+		public override object this[object key] 
+		{
+			get
+            {
+                object value = null;
+                if (cache.TryGetValue(key, out value))
+                {
+                    keyList.Remove(key);
+                    keyList.AddLast(key);
+                }
+                return value;
+            }
+			set
+			{
+                cache[key] = value;
+                keyList.AddLast(key);
+                if (keyList.Count > size)
+                {
+                    LinkedListNode<object> oldestKey = keyList.First;
+                    keyList.RemoveFirst();
+                    cache.Remove(oldestKey.Value);
+                }
+			}
+		}
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool  ContainsKey(object key)
+        {
+            return keyList.Contains(key);
+        }
+
+	}
+}

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/PerpetualCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/PerpetualCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/PerpetualCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/PerpetualCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,120 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date: 2008-06-07 10:14:33 +0200 (sam., 07 juin 2008) $
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System.Collections.Generic;
+
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Implementation
+{
+	/// <summary>
+	/// A read-only cache implementation where cache object are shared among all users and therefore offer greater performance benefit. 
+    /// However, objects read from a read-only cache should not be modified. 	
+    /// </summary>
+	/// <remarks>
+    /// eq to SHARED_READ_ONLY
+	/// </remarks>
+	public sealed class PerpetualCache : BaseCache	
+	{
+	    private readonly IDictionary<object, object> cache = new Dictionary<object, object>();
+
+		/// <summary>
+		/// Constructor
+		/// </summary>
+		public PerpetualCache() 
+		{
+            cache = new Dictionary<object, object>();
+		}
+
+		#region ICache Members
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return cache.Count; }
+        }
+
+		/// <summary>
+		/// Remove an object from a cache model
+		/// </summary>
+		/// <param name="key">the key to the object</param>
+		/// <returns>the removed object</returns>
+		public override object Remove(object key)
+		{
+            object value = null;
+            cache.TryGetValue(key, out value);
+            cache.Remove(key);
+            return value;
+		}
+
+		/// <summary>
+		/// Adds an item with the specified key and value into cached data.
+		/// Gets a cached object with the specified key.
+		/// </summary>
+		/// <value>The cached object or <c>null</c></value>
+		public override object this [object key] 
+		{
+			get
+            {
+                object value = null;
+                cache.TryGetValue(key, out value);
+                return value;
+            }
+            set
+            {
+
+                cache[key] = value;
+            }
+		}
+
+
+		/// <summary>
+		/// Clears all elements from the cache.
+		/// </summary>
+        public override void Clear()
+		{
+           cache.Clear();
+		}
+
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            return cache.ContainsKey(key);                
+        }
+
+		#endregion
+
+	}
+}

Added: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs?rev=669636&view=auto
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs (added)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs Thu Jun 19 11:38:37 2008
@@ -0,0 +1,133 @@
+
+#region Apache Notice
+/*****************************************************************************
+ * $Header: $
+ * $Revision: 383115 $
+ * $Date$
+ * 
+ * iBATIS.NET Data Mapper
+ * Copyright (C) 2004 - Gilles Bayon
+ *  
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * 
+ ********************************************************************************/
+#endregion
+
+using System;
+using System.Collections.Generic;
+
+namespace Apache.Ibatis.DataMapper.Model.Cache.Implementation
+{
+	/// <summary>
+    /// Weak Cache implementation.
+	/// </summary>
+	public sealed class WeakCache: BaseCache	
+	{
+        private readonly IDictionary<object, WeakReference> cache = new Dictionary<object, WeakReference>();
+
+		/// <summary>
+		/// Constructor
+		/// </summary>
+        public WeakCache() 
+		{
+            cache = new Dictionary<object, WeakReference>();
+		}
+
+		#region ICache Members
+
+        /// <summary>
+        /// Gets the size.
+        /// </summary>
+        /// <value>The size.</value>
+        public override int Size
+        {
+            get { return cache.Count; }
+        }
+
+		/// <summary>
+		/// Remove an object from a cache model
+		/// </summary>
+		/// <param name="key">the key to the object</param>
+		/// <returns>the removed object</returns>
+		public override object Remove(object key)
+		{
+            object value = null;
+            WeakReference reference = null;
+            if (cache.TryGetValue(key, out reference))
+            {
+                cache.Remove(key);
+                value = reference.Target;
+            }
+            return value;
+		}
+
+		/// <summary>
+		/// Adds an item with the specified key and value into cached data.
+		/// Gets a cached object with the specified key.
+		/// </summary>
+		/// <value>The cached object or <c>null</c></value>
+        public override object this[object key]
+		{
+			get
+            {
+                object value = null;
+                WeakReference reference = null;
+
+                if (cache.TryGetValue(key, out reference))
+                {
+                    if (reference.IsAlive)
+                    {
+                        value = reference.Target;
+                    }
+                    else
+                    {
+                        Remove(key);
+                    }
+                }
+                return value;
+            }
+            set
+            {
+                WeakReference reference = new WeakReference(value, false);
+                cache[key] = reference;
+            }
+		}
+
+
+		/// <summary>
+		/// Clears all elements from the cache.
+		/// </summary>
+        public override void Clear()
+        {
+            cache.Clear();
+		}
+
+
+        /// <summary>
+        /// Determines whether the cache contains the key.
+        /// </summary>
+        /// <param name="key">The key.</param>
+        /// <returns>
+        /// 	<c>true</c> if the specified key contains key; otherwise, <c>false</c>.
+        /// </returns>
+        public override bool ContainsKey(object key)
+        {
+            return cache.ContainsKey(key);
+        }
+
+		#endregion
+
+	}
+}
+

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/Cache/Implementation/WeakCache.cs
------------------------------------------------------------------------------
    svn:keywords = Id LastChangedDate LastChangedBy

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/DefaultModelStore.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/DefaultModelStore.cs?rev=669636&r1=669635&r2=669636&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/DefaultModelStore.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/DefaultModelStore.cs Thu Jun 19 11:38:37 2008
@@ -25,19 +25,17 @@
 #endregion
 
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Text;
-using Apache.Ibatis.Common.Data;
+using Apache.Ibatis.Common.Utilities;
+using Apache.Ibatis.DataMapper.Data;
 using Apache.Ibatis.DataMapper.DataExchange;
 using Apache.Ibatis.DataMapper.Exceptions;
 using Apache.Ibatis.DataMapper.MappedStatements;
 using Apache.Ibatis.DataMapper.Model.Cache;
 using Apache.Ibatis.DataMapper.Model.ParameterMapping;
 using Apache.Ibatis.DataMapper.Model.ResultMapping;
-using Apache.Ibatis.DataMapper.Data;
 using Apache.Ibatis.DataMapper.Session;
-using Apache.Ibatis.Common.Utilities;
-using System.Diagnostics;
-using System;
 
 namespace Apache.Ibatis.DataMapper.Model
 {
@@ -126,15 +124,15 @@
         /// <summary>
         /// Gets a ResultMap by Id
         /// </summary>
-        /// <param name="id">The id.</param>
+        /// <param name="resultMapId">The ResultMap id.</param>
         /// <returns>The ResultMap</returns>
-        public IResultMap GetResultMap(string id)
+        public IResultMap GetResultMap(string resultMapId)
         {
-            if (resultMaps.ContainsKey(id) == false)
+            if (resultMaps.ContainsKey(resultMapId) == false)
             {
-                throw new DataMapperException("The DataMapper does not contain an ResultMap named " + id);
+                throw new DataMapperException("The DataMapper does not contain an ResultMap named " + resultMapId);
             }
-            return resultMaps[id];
+            return resultMaps[resultMapId];
         }
 
         /// <summary>
@@ -153,15 +151,15 @@
         /// <summary>
         /// Get a ParameterMap by id
         /// </summary>
-        /// <param name="id">The id of the ParameterMap</param>
+        /// <param name="parameterMapId">The id of the ParameterMap</param>
         /// <returns>The ParameterMap</returns>
-        public ParameterMap GetParameterMap(string id)
+        public ParameterMap GetParameterMap(string parameterMapId)
         {
-            if (!parameterMaps.ContainsKey(id))
+            if (!parameterMaps.ContainsKey(parameterMapId))
             {
-                throw new DataMapperException("The DataMapper does not contain an ParameterMap named " + id + ".  ");
+                throw new DataMapperException("The DataMapper does not contain an ParameterMap named " + parameterMapId + ".  ");
             }
-            return parameterMaps[id];
+            return parameterMaps[parameterMapId];
         }
 
         /// <summary>
@@ -180,15 +178,15 @@
         /// <summary>
         /// Gets a MappedStatement by name
         /// </summary>
-        /// <param name="id"> The id of the statement</param>
+        /// <param name="mappedStatementId"> The id of the statement</param>
         /// <returns> The MappedStatement</returns>
-        public IMappedStatement GetMappedStatement(string id)
+        public IMappedStatement GetMappedStatement(string mappedStatementId)
         {
-            if (!mappedStatements.ContainsKey(id))
+            if (!mappedStatements.ContainsKey(mappedStatementId))
             {
-                throw new DataMapperException("The DataMapper does not contain a MappedStatement named " + id);
+                throw new DataMapperException("The DataMapper does not contain a MappedStatement named " + mappedStatementId);
             }
-            return mappedStatements[id];
+            return mappedStatements[mappedStatementId];
         }
 
         /// <summary>
@@ -208,15 +206,15 @@
         /// <summary>
         /// Gets a cache model by id
         /// </summary>
-        /// <param name="id">The id of the cache model</param>
+        /// <param name="cacheModelId">The id of the cache model</param>
         /// <returns>The cache model</returns>
-        public CacheModel GetCacheModel(string id)
+        public CacheModel GetCacheModel(string cacheModelId)
         {
-            if (!cacheModels.ContainsKey(id))
+            if (!cacheModels.ContainsKey(cacheModelId))
             {
-                throw new DataMapperException("The DataMapper does not contain a CacheModel named " + id);
+                throw new DataMapperException("The DataMapper does not contain a CacheModel named " + cacheModelId);
             }
-            return cacheModels[id];
+            return cacheModels[cacheModelId];
         }
 
 
@@ -241,54 +239,10 @@
         {
             foreach(CacheModel cacheModel in cacheModels.Values)
             {
-                cacheModel.Flush();
+                cacheModel.Cache.Clear();
             }
         }
 
-        /// <summary>
-        /// Gets the data cache statistique.
-        /// </summary>
-        /// <returns></returns>
-        public string GetDataCacheStats()
-        {
-            StringBuilder buffer = new StringBuilder();
-            buffer.Append(Environment.NewLine);
-            buffer.Append("Cache Data Statistics");
-            buffer.Append(Environment.NewLine);
-            buffer.Append("=====================");
-            buffer.Append(Environment.NewLine);
-
-            foreach(IMappedStatement mappedStatement in mappedStatements.Values)
-            {
-                buffer.Append(mappedStatement.Id);
-                buffer.Append(": ");
-
-                if (mappedStatement is CachingStatement)
-                {
-                    double hitRatio = ((CachingStatement)mappedStatement).GetDataCacheHitRatio();
-                    if (hitRatio != -1)
-                    {
-                        buffer.Append(Math.Round(hitRatio * 100));
-                        buffer.Append("%");
-                    }
-                    else
-                    {
-                        // this statement has a cache but it hasn't been accessed yet
-                        // buffer.Append("Cache has not been accessed."); ???
-                        buffer.Append("No Cache.");
-                    }
-                }
-                else
-                {
-                    buffer.Append("No Cache.");
-                }
-
-                buffer.Append(Environment.NewLine);
-            }
-
-            return buffer.ToString();
-        }
-
         #endregion
 
         /// <summary>
@@ -310,7 +264,7 @@
             IEnumerator<CacheModel> caches = cacheModels.Values.GetEnumerator();
             while (caches.MoveNext())
             {
-                builder.AppendLine(string.Empty.PadLeft(level * 3, ' ') + caches.Current.Id + "/" + caches.Current.Implementation);
+                builder.AppendLine(string.Empty.PadLeft(level * 3, ' ') + caches.Current.Id + "/" + caches.Current.Cache);
             }
             builder.AppendLine(string.Empty);
 
@@ -321,7 +275,7 @@
                builder.AppendLine(string.Empty.PadLeft(level * 3, ' ') + rMaps.Current.Id + "/" + rMaps.Current.Class.Name);
                for (int i = 0; i < rMaps.Current.Parameters.Count; i++)
                {
-                   builder.AppendLine(string.Empty.PadLeft(level * 2 * 3, ' ') + " Argument: "+((ArgumentProperty)rMaps.Current.Parameters[i]).ArgumentName);
+                   builder.AppendLine(string.Empty.PadLeft(level * 2 * 3, ' ') + " Argument: "+(rMaps.Current.Parameters[i]).ArgumentName);
                }
                for (int i = 0; i < rMaps.Current.Properties.Count; i++ )
                {

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/IModelStore.cs
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/IModelStore.cs?rev=669636&r1=669635&r2=669636&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/IModelStore.cs (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/Model/IModelStore.cs Thu Jun 19 11:38:37 2008
@@ -137,12 +137,6 @@
         /// Flushes the caches.
         /// </summary>
         void FlushCaches();
-
-        /// <summary>
-        /// Gets the data cache statistique.
-        /// </summary>
-        /// <returns></returns>
-        string GetDataCacheStats();
         
     }
 }

Modified: ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd
URL: http://svn.apache.org/viewvc/ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd?rev=669636&r1=669635&r2=669636&view=diff
==============================================================================
--- ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd (original)
+++ ibatis/trunk/cs/V3/src/Apache.Ibatis.DataMapper/SqlMap.xsd Thu Jun 19 11:38:37 2008
@@ -48,22 +48,13 @@
 	<xs:element name="cacheModel">
 		<xs:complexType>
 			<xs:sequence maxOccurs="unbounded">
-				<xs:element ref="flushInterval" minOccurs="0"/>
 				<xs:element ref="flushOnExecute" minOccurs="0" maxOccurs="unbounded"/>
-				<xs:element ref="property" minOccurs="0" maxOccurs="unbounded"/>
 			</xs:sequence>
 			<xs:attribute name="id" type="xs:string" use="required"/>
-			<xs:attribute name="serialize" type="xs:string"  default="false"/>
-			<xs:attribute name="readOnly" type="xs:string"  default="true"/>
-			<xs:attribute name="implementation" use="required">
-				<xs:simpleType>
-					<xs:restriction base="xs:NMTOKEN">
-						<xs:enumeration value="LRU"/>
-						<xs:enumeration value="MEMORY"/>
-						<xs:enumeration value="FIFO"/>
-					</xs:restriction>
-				</xs:simpleType>
-			</xs:attribute>
+			<xs:attribute name="share" type="xs:string"  default="false"/>
+			<xs:attribute name="flushInterval" type="xs:positiveInteger"  />
+			<xs:attribute name="size" type="xs:positiveInteger"  />
+			<xs:attribute name="type" type="xs:string" use="required"/>
 		</xs:complexType>
 	</xs:element>
 	<xs:element name="cacheModels">