Author: ornicar2
Date: 2010-02-03 19:23:30 +0100 (Wed, 03 Feb 2010)
New Revision: 27506
Modified:
plugins/diemPlugin/trunk/dmCorePlugin/lib/routing/dmPatternRouting.php
Log:
[Diem]
- disabled routing cache for jQuery random requests to avoid APC overhead
Modified: plugins/diemPlugin/trunk/dmCorePlugin/lib/routing/dmPatternRouting.php
===================================================================
--- plugins/diemPlugin/trunk/dmCorePlugin/lib/routing/dmPatternRouting.php
2010-02-03 17:19:57 UTC (rev 27505)
+++ plugins/diemPlugin/trunk/dmCorePlugin/lib/routing/dmPatternRouting.php
2010-02-03 18:23:30 UTC (rev 27506)
@@ -17,4 +17,30 @@
parent::initialize($dispatcher, $cache, $options);
}
+ /*
+ * Disable cache when the request contain a "_" paremeter
+ * This parameter is set randomly by jQuery to avoid browser cache
+ * Cache it quickly leads to thousands cache entries
+ */
+ public function findRoute($url)
+ {
+ if($this->cache && (strpos($this->options['context']['request_uri'],
'?_=') || strpos($this->options['context']['request_uri'], '&_=')))
+ {
+ // remember the cache and disable it
+ $cache = $this->cache;
+ $this->cache = null;
+
+ // get the result without cache
+ $result = parent::findRoute($url);
+
+ // restore the cache
+ $this->cache = $cache;
+
+ return $result;
+ }
+ else
+ {
+ return parent::findRoute($url);
+ }
+ }
}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.