| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
Cache_Lite::Cache_Lite (automaticCleaning)
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
|
|
|
6 |
require_once('callcache.inc');
|
|
|
7 |
require_once('tmpdir.inc');
|
|
|
8 |
require_once('cache_lite_base.inc');
|
|
|
9 |
|
|
|
10 |
$options = array(
|
|
|
11 |
'cacheDir' => tmpDir() . '/',
|
|
|
12 |
'lifeTime' => 2,
|
|
|
13 |
'automaticCleaningFactor' => 1
|
|
|
14 |
);
|
|
|
15 |
|
|
|
16 |
$Cache_Lite = new Cache_Lite($options);
|
|
|
17 |
callCache('31415926');
|
|
|
18 |
echo("\n");
|
|
|
19 |
callCache('31415926');
|
|
|
20 |
echo("\n");
|
|
|
21 |
callCache('31415926bis');
|
|
|
22 |
echo("\n");
|
|
|
23 |
callCache('31415926bis');
|
|
|
24 |
echo("\n");
|
|
|
25 |
sleep(4);
|
|
|
26 |
callCache('31415926'); // '31415926bis' will be cleaned
|
|
|
27 |
echo "\n";
|
|
|
28 |
$dh = opendir(tmpDir());
|
|
|
29 |
while ($file = readdir($dh)) {
|
|
|
30 |
if (($file != '.') && ($file != '..')) {
|
|
|
31 |
if (substr($file, 0, 6)=='cache_') {
|
|
|
32 |
echo "$file\n";
|
|
|
33 |
}
|
|
|
34 |
}
|
|
|
35 |
}
|
|
|
36 |
|
|
|
37 |
$Cache_Lite->remove('31415926');
|
|
|
38 |
$Cache_Lite->remove('31415926bis');
|
|
|
39 |
|
|
|
40 |
?>
|
|
|
41 |
--GET--
|
|
|
42 |
--POST--
|
|
|
43 |
--EXPECT--
|
|
|
44 |
Cache Missed !
|
|
|
45 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
46 |
Cache Hit !
|
|
|
47 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
48 |
Cache Missed !
|
|
|
49 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
50 |
Cache Hit !
|
|
|
51 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
52 |
Cache Missed !
|
|
|
53 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
54 |
cache_c21f969b5f03d33d43e04f8f136e7682_e9982ec5ca981bd365603623cf4b2277
|