$driver = 'Null';
}
- return $this->_create($driver, $injector);
- }
-
- /**
- * Return the Horde_Cache_Session:: instance.
- *
- * @return Horde_Cache_Session
- * @throws Horde_Cache_Exception
- */
- public function createSession(Horde_Injector $injector)
- {
- return $this->_create('Session', $injector);
- }
-
- /**
- * @see create()
- */
- private function _create($driver, $injector)
- {
$params = Horde::getDriverConfig('cache', $driver);
if (isset($GLOBALS['conf']['cache']['default_lifetime'])) {
$params['lifetime'] = $GLOBALS['conf']['cache']['default_lifetime'];
'Horde_Alarm' => 'Horde_Core_Factory_Alarm',
'Horde_Browser' => 'Horde_Core_Factory_Browser',
'Horde_Cache' => 'Horde_Core_Factory_Cache',
- 'Horde_Cache_Session' => array(
- 'Horde_Core_Factory_Cache',
- 'createSession',
- ),
'Horde_Controller_Request' => 'Horde_Core_Factory_Request',
'Horde_Controller_RequestConfiguration' => array(
'Horde_Core_Controller_RequestMapper',
/* If an IMP_Imap_Tree object is currently stored in the cache,
* re-create that object. Else, create a new instance. */
- if (isset($session['imp:tree'])) {
+ if (isset($session['imp:treeob'])) {
/* Since IMAP tree generation is so expensive/time-consuming,
* fallback to storing in the session even if no permanent cache
* backend is setup. */
$cache = $injector->getInstance('Horde_Cache');
if ($cache instanceof Horde_Cache_Null) {
- $cache = $injector->getInstance('Horde_Cache_Session');
- }
-
- try {
- $instance = @unserialize($cache->get($session['imp:tree'], 86400));
- } catch (Exception $e) {
- Horde::logMessage('Could not unserialize stored IMP_Imap_Tree object.', 'DEBUG');
+ $instance = $session[Horde_Session::DATA . ':imp_imaptree'];
+ } else {
+ try {
+ $instance = @unserialize($cache->get($session['imp:treeob'], 86400));
+ } catch (Exception $e) {
+ Horde::logMessage('Could not unserialize stored IMP_Imap_Tree object.', 'DEBUG');
+ }
}
} else {
- $session['imp:tree'] = strval(new Horde_Support_Randomid());
+ $session['imp:treeob'] = strval(new Horde_Support_Randomid());
}
if (!($instance instanceof IMP_Imap_Tree)) {
*/
public function shutdown($instance, $injector)
{
+ global $session;
+
/* Only need to store the object if the tree has changed. */
if ($instance->changed) {
$cache = $injector->getInstance('Horde_Cache');
if ($cache instanceof Horde_Cache_Null) {
- $cache = $injector->getInstance('Horde_Cache_Session');
+ $session->store($instance, true, 'imp_imaptree');
+ } else {
+ $cache->set($GLOBALS['session']['imp:treeob'], serialize($instance), 86400);
}
- $cache->set($GLOBALS['session']['imp:tree'], serialize($instance), 86400);
}
}