[gxml] * add ability to clear the object cache



commit 4e6339c7b5ac7a927811662c8c47f3b90910796d
Author: Richard Schwarting <aquarichy gmail com>
Date:   Wed Aug 22 12:37:59 2012 -0400

    * add ability to clear the object cache

 gxml/Serialization.vala |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gxml/Serialization.vala b/gxml/Serialization.vala
index f8bf6ac..2c6a824 100644
--- a/gxml/Serialization.vala
+++ b/gxml/Serialization.vala
@@ -17,7 +17,7 @@
  * Authors:
  *       Richard Schwarting <aquarichy gmail com>
  */
- 
+
 /* TODO: so it seems we can get property information from GObjectClass
    but that's about it.  Need to definitely use introspection for anything
    tastier */
@@ -295,12 +295,17 @@ namespace GXml {
 		 * This table is used while deserializing objects to avoid
 		 * creating duplicate objects when we encounter multiple
 		 * references to a single serialized object.
-		 * 
+		 *
 		 * TODO: one problem, if you deserialize two XML structures,
 		 * some differing objects might have the same OID :( Need to
 		 * find make it more unique than just the memory address. */
 		private static HashTable<string,Object> cache = null;
 
+		public static void clear_cache () {
+			if (Serialization.cache != null)
+				Serialization.cache.remove_all ();
+		}
+
 		/**
 		 * Deserialize a { link GXml.DomNode} back into a { link GLib.Object}.
 		 *



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]