- added RemoveObjectFromCache() to ISession

git-svn-id: https://svn.apache.org/repos/asf/chemistry/dotcmis/trunk@1091377 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/DotCMIS/client/client-caches.cs b/DotCMIS/client/client-caches.cs
index c059bf5..17d5e87 100644
--- a/DotCMIS/client/client-caches.cs
+++ b/DotCMIS/client/client-caches.cs
@@ -35,6 +35,7 @@
         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 @@
         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 @@
         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 @@
             }

         }

 

+        public void Remove(string objectId)

+        {

+            if (objectId == null)

+            {

+                return;

+            }

+

+            Lock();

+            try

+            {

+                objectCache.Remove(objectId);

+            }

+            finally

+            {

+                Unlock();

+            }

+        }

+

         public int CacheSize

         {

             get { return cacheSize; }

diff --git a/DotCMIS/client/client-impl.cs b/DotCMIS/client/client-impl.cs
index 7dc508e..e303bbc 100644
--- a/DotCMIS/client/client-impl.cs
+++ b/DotCMIS/client/client-impl.cs
@@ -565,6 +565,21 @@
             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)

diff --git a/DotCMIS/client/client-intf.cs b/DotCMIS/client/client-intf.cs
index 8eacc5d..1254b44 100644
--- a/DotCMIS/client/client-intf.cs
+++ b/DotCMIS/client/client-intf.cs
@@ -201,6 +201,18 @@
         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>