blob: f7be048f807a687a383fc7f06b056e269abb82fb (
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
53
54
55
56
57
58
59
60
61
62
63
64
|
<?php defined('SYSPATH') OR die('No direct access allowed.');
/**
* APC-based Cache driver.
*
* $Id: Apc.php 4046 2009-03-05 19:23:29Z Shadowhand $
*
* @package Cache
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @license http://kohanaphp.com/license.html
*/
class Cache_Apc_Driver implements Cache_Driver {
public function __construct()
{
if ( ! extension_loaded('apc'))
throw new Kohana_Exception('cache.extension_not_loaded', 'apc');
}
public function get($id)
{
return (($return = apc_fetch($id)) === FALSE) ? NULL : $return;
}
public function set($id, $data, array $tags = NULL, $lifetime)
{
if ( ! empty($tags))
{
Kohana::log('error', 'Cache: tags are unsupported by the APC driver');
}
return apc_store($id, $data, $lifetime);
}
public function find($tag)
{
Kohana::log('error', 'Cache: tags are unsupported by the APC driver');
return array();
}
public function delete($id, $tag = FALSE)
{
if ($tag === TRUE)
{
Kohana::log('error', 'Cache: tags are unsupported by the APC driver');
return FALSE;
}
elseif ($id === TRUE)
{
return apc_clear_cache('user');
}
else
{
return apc_delete($id);
}
}
public function delete_expired()
{
return TRUE;
}
} // End Cache APC Driver
|