aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cache/factory.php
blob: cc88780bf2966b0db6dcee2232dc0e61509fceab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
*
* @package acm
* @version $Id$
* @copyright (c) 2010 phpBB Group
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
* @package acm
*/
class phpbb_cache_factory
{
	private $acm_type;
	
	public function __construct($acm_type)
	{
		$this->acm_type = $acm_type;
	}
	
	public function get_acm()
	{
		$class_name = 'phpbb_cache_driver_' . $this->acm_type;
		return new $class_name();
	}
	
	public function get_service()
	{
		$acm = $this->get_acm();
		$service = new phpbb_cache_service($acm);
		return $service;
	}
	
	/**
	* for convenience to allow:
	* $cache = phpbb_cache_factory::create('file')->get_service();
	*/
	public static function create($acm_type)
	{
		return new self($acm_type);
	}
}