sets up observers, and sets up an interval for purging expired method cache objects
authorpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 6 May 2007 09:03:17 +0000 (09:03 +0000)
committerpines <pines@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 6 May 2007 09:03:17 +0000 (09:03 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@7206 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/xul/staff_client/server/main/data.xul

index dd35949..962b580 100644 (file)
                        g.data.stash('session');
                        g.data.on_complete = function () {
 
-                               g.data.stash('list','hash','tree','temp');
+                               g.data.stash('list','hash','tree','temp','cached_request');
+
+                               setInterval(
+                                       function() {
+                                               try {
+                                                       var remove_me = [];
+                                                       var n = Number( new Date() );
+                                                       for (var i in g.data.cached_request) {
+                                                               if (g.data.cached_request[i].expire_time < n && g.data.cached_request[i].status != 'pending') remove_me.push(i);
+                                                       }
+                                                       dump('trimming ' + remove_me.length + ' requests from cache\n');
+                                                       for (var i in remove_me) delete g.data.cached_request[i];
+                                               } catch(E) {
+                                                       alert(E);
+                                               }
+                                       }, 180000
+                               );
+
                                g.data._debug_stash();
 
                                document.getElementById('iframe').setAttribute(
@@ -80,6 +97,9 @@
                        }
 
                        g.data.init();
+       
+                       g.data.init_observer_functions();
+
                }
        ]]>
        </script>