You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/04/12 13:40:26 UTC

svn commit: r1091377 - in /chemistry/dotcmis/trunk/DotCMIS/client: client-caches.cs client-impl.cs client-intf.cs

Author: fmui
Date: Tue Apr 12 11:40:26 2011
New Revision: 1091377

URL: http://svn.apache.org/viewvc?rev=1091377&view=rev
Log:
- added RemoveObjectFromCache() to ISession

Modified:
    chemistry/dotcmis/trunk/DotCMIS/client/client-caches.cs
    chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs
    chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs

Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-caches.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-caches.cs?rev=1091377&r1=1091376&r2=1091377&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-caches.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-caches.cs Tue Apr 12 11:40:26 2011
@@ -35,6 +35,7 @@ namespace DotCMIS.Client.Impl.Cache
         void PutPath(string path, ICmisObject cmisObject, string cacheKey);
         ICmisObject GetById(string objectId, string cacheKey);
         ICmisObject GetByPath(string path, string cacheKey);
+        void Remove(string objectId);
         void Clear();
         int CacheSize { get; }
     }
@@ -51,6 +52,7 @@ namespace DotCMIS.Client.Impl.Cache
         public void PutPath(string path, ICmisObject cmisObject, string cacheKey) { }
         public ICmisObject GetById(string objectId, string cacheKey) { return null; }
         public ICmisObject GetByPath(string path, string cacheKey) { return null; }
+        public void Remove(string objectId) { }
         public void Clear() { }
         public int CacheSize { get { return 0; } }
     }
@@ -271,7 +273,7 @@ namespace DotCMIS.Client.Impl.Cache
         public void PutPath(string path, ICmisObject cmisObject, string cacheKey)
         {
             // no path, no object, no id, no cache key - no cache
-            if (path ==null || cmisObject == null || cmisObject.Id == null || cacheKey == null)
+            if (path == null || cmisObject == null || cmisObject.Id == null || cacheKey == null)
             {
                 return;
             }
@@ -288,6 +290,24 @@ namespace DotCMIS.Client.Impl.Cache
             }
         }
 
+        public void Remove(string objectId)
+        {
+            if (objectId == null)
+            {
+                return;
+            }
+
+            Lock();
+            try
+            {
+                objectCache.Remove(objectId);
+            }
+            finally
+            {
+                Unlock();
+            }
+        }
+
         public int CacheSize
         {
             get { return cacheSize; }

Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs?rev=1091377&r1=1091376&r2=1091377&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-impl.cs Tue Apr 12 11:40:26 2011
@@ -565,6 +565,21 @@ namespace DotCMIS.Client.Impl
             return result;
         }
 
+        public void RemoveObjectFromCache(IObjectId objectId)
+        {
+            if (objectId == null || objectId.Id == null)
+            {
+                return;
+            }
+
+            RemoveObjectFromCache(objectId.Id);
+        }
+
+        public void RemoveObjectFromCache(string objectId)
+        {
+            Cache.Remove(objectId);
+        }
+
         // discovery
 
         public IItemEnumerable<IQueryResult> Query(string statement, bool searchAllVersions)

Modified: chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs
URL: http://svn.apache.org/viewvc/chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs?rev=1091377&r1=1091376&r2=1091377&view=diff
==============================================================================
--- chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs (original)
+++ chemistry/dotcmis/trunk/DotCMIS/client/client-intf.cs Tue Apr 12 11:40:26 2011
@@ -201,6 +201,18 @@ namespace DotCMIS.Client
         ICmisObject GetObjectByPath(string path);
         ICmisObject GetObjectByPath(string path, IOperationContext context);
 
+        /// <summary>
+        ///  Removes the given object from the cache.
+        /// </summary>
+        /// <param name="objectId">the object id</param>
+        void RemoveObjectFromCache(IObjectId objectId);
+
+        /// <summary>
+        ///  Removes the given object from the cache.
+        /// </summary>
+        /// <param name="objectId">the object id</param>
+        void RemoveObjectFromCache(string objectId);
+
         // discovery
 
         /// <summary>