--- advcache.module.orig	2008-10-12 06:43:03.000000000 -0400
+++ advcache.module	2008-11-03 17:21:26.508224958 -0500
@@ -86,4 +86,23 @@
 
 function advcache_devel_caches() {
   return array('cache_advcache_block', 'cache_comment', 'cache_forum', 'cache_node', 'cache_path', 'cache_search', 'cache_taxonomy');
-}
\ No newline at end of file
+}
+
+// Helper functions to improve memcache interop
+function advcache_serialize($data) {
+  if (strpos(variable_get('cache_inc', ''), 'memcache') !== FALSE) {
+    return $data;
+  }
+  else {
+    return serialize($data);
+  }
+}
+
+function advcache_unserialize($data) {
+  if (strpos(variable_get('cache_inc', ''), 'memcache') !== FALSE) {
+    return $data;
+  }
+  else {
+    return unserialize($data);
+  }
+}
