public
function
__construct(
$name
= null)
{
$this
->load_config(
$name
);
if
(
$this
->config[
'driver'
]==Cache::DRIVER_FILE)
{
$this
->check_file_config(
$name
);
}
$driver
=
'Cache_Driver_'
.
$this
->config[
'driver'
];
if
(!
class_exists
(
$driver
, true))
{
throw
new
Exception(__(
'The :type driver :driver does not exist'
,
array
(
':type'
=>
'Cache'
,
':driver'
=>
$this
->config[
'driver'
])));
}
$this
->driver =
new
$driver
(
$this
->config[
'driver_config'
]);
# 设置前缀
if
(
$this
->config[
'prefix'
])
{
$this
->driver->set_prefix(
$this
->config[
'prefix'
]);
}
}