1: <?php
2: /**
3: * Cache storage implementation using Horde_Session.
4: *
5: * Copyright 2010-2012 Horde LLC (http://www.horde.org/)
6: *
7: * See the enclosed file COPYING for license information (LGPL). If you
8: * did not receive this file, see http://www.horde.org/licenses/lgpl21.
9: *
10: * @author Michael Slusarz <slusarz@horde.org>
11: * @category Horde
12: * @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
13: * @package Core
14: */
15: class Horde_Core_Prefs_Cache_Session extends Horde_Prefs_Cache_Base
16: {
17: const SESS_KEY = 'prefs_cache/';
18:
19: /**
20: */
21: public function get($scope)
22: {
23: global $session;
24:
25: return $session->exists('horde', self::SESS_KEY . $this->_params['user'] . '/' . $scope)
26: ? $session->get('horde', self::SESS_KEY . $this->_params['user'] . '/' . $scope)
27: : false;
28: }
29:
30: /**
31: */
32: public function store($scope_ob)
33: {
34: $GLOBALS['session']->set('horde', self::SESS_KEY . $this->_params['user'] . '/' . $scope_ob->scope, $scope_ob);
35: }
36:
37: /**
38: */
39: public function remove($scope = null)
40: {
41: $GLOBALS['session']->remove('horde', self::SESS_KEY . $this->_params['user'] . '/' . strval($scope));
42: }
43:
44: }
45: