1: <?php
2: /**
3: * Cache driver for the preferences system.
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 Prefs
14: */
15: abstract class Horde_Prefs_Cache_Base
16: {
17: /**
18: * Configuration parameters.
19: * 'user' is always available as an entry.
20: *
21: * @var string
22: */
23: protected $_params = array();
24:
25: /**
26: * Constructor.
27: *
28: * @param string $user The username.
29: * @param array $params Additional configuration parameters.
30: */
31: public function __construct($user, array $params = array())
32: {
33: $this->_params = array_merge($this->_params, $params);
34: $this->_params['user'] = $user;
35: }
36:
37: /**
38: * Retrieves the requested preferences scope from the cache backend.
39: *
40: * @param string $scope Scope specifier.
41: *
42: * @return mixed Returns false if no data is available, otherwise the
43: * Horde_Prefs_Scope object.
44: * @throws Horde_Prefs_Exception
45: */
46: abstract public function get($scope);
47:
48: /**
49: * Stores preferences in the cache backend.
50: *
51: * @param Horde_Prefs_Scope $scope_ob The scope object to store.
52: *
53: * @throws Horde_Prefs_Exception
54: */
55: abstract public function store($scope_ob);
56:
57: /**
58: * Removes preferences from the cache.
59: *
60: * @param string $scope The scope to remove. If null, clears entire
61: * cache.
62: *
63: * @throws Horde_Prefs_Exception
64: */
65: abstract public function remove($scope = null);
66:
67: }
68: