| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
Cache_Lite::Cache_Lite_File (classical)
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
|
|
|
6 |
require_once('callcache.inc');
|
|
|
7 |
require_once('tmpdir.inc');
|
|
|
8 |
require_once('cache_lite_file_base.inc');
|
|
|
9 |
|
|
|
10 |
$master = tmpDir() . '/' . 'foobar.masterfile';
|
|
|
11 |
$options = array(
|
|
|
12 |
'cacheDir' => tmpDir() . '/',
|
|
|
13 |
'lifeTime' => 60,
|
|
|
14 |
'masterFile' => $master
|
|
|
15 |
);
|
|
|
16 |
|
|
|
17 |
$f = fopen($master, 'w');
|
|
|
18 |
fwrite($f, 'foobar');
|
|
|
19 |
fclose($f);
|
|
|
20 |
sleep(1);
|
|
|
21 |
|
|
|
22 |
$Cache_Lite = new Cache_Lite_File($options);
|
|
|
23 |
multipleCallCache('string');
|
|
|
24 |
multipleCallCache3_1('string');
|
|
|
25 |
|
|
|
26 |
echo "==> We touch masterFile\n";
|
|
|
27 |
touch($master);
|
|
|
28 |
sleep(1);
|
|
|
29 |
clearstatcache();
|
|
|
30 |
echo "\nDone !\n\n";
|
|
|
31 |
$Cache_Lite = new Cache_Lite_File($options);
|
|
|
32 |
sleep(1);
|
|
|
33 |
multipleCallCache3_2('string');
|
|
|
34 |
|
|
|
35 |
?>
|
|
|
36 |
--GET--
|
|
|
37 |
--POST--
|
|
|
38 |
--EXPECT--
|
|
|
39 |
==> First call (cache should be missed)
|
|
|
40 |
Cache Missed !
|
|
|
41 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
42 |
Done !
|
|
|
43 |
|
|
|
44 |
==> Second call (cache should be hit)
|
|
|
45 |
Cache Hit !
|
|
|
46 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
47 |
Done !
|
|
|
48 |
|
|
|
49 |
==> Third call (cache should be hit)
|
|
|
50 |
Cache Hit !
|
|
|
51 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
52 |
Done !
|
|
|
53 |
|
|
|
54 |
==> We remove cache
|
|
|
55 |
Done !
|
|
|
56 |
|
|
|
57 |
==> Fourth call (cache should be missed)
|
|
|
58 |
Cache Missed !
|
|
|
59 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
60 |
Done !
|
|
|
61 |
|
|
|
62 |
==> #5 Call with another id (cache should be missed)
|
|
|
63 |
Cache Missed !
|
|
|
64 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
65 |
Done !
|
|
|
66 |
|
|
|
67 |
==> We remove cache
|
|
|
68 |
Done !
|
|
|
69 |
==> #6 call (cache should be missed)
|
|
|
70 |
Cache Missed !
|
|
|
71 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
72 |
Done !
|
|
|
73 |
|
|
|
74 |
==> #7 call (cache should be hit)
|
|
|
75 |
Cache Hit !
|
|
|
76 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
77 |
Done !
|
|
|
78 |
|
|
|
79 |
==> We touch masterFile
|
|
|
80 |
|
|
|
81 |
Done !
|
|
|
82 |
|
|
|
83 |
==> #8 call (cache should be missed)
|
|
|
84 |
Cache Missed !
|
|
|
85 |
0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
|
|
|
86 |
Done !
|
|
|
87 |
|
|
|
88 |
==> We remove cache
|
|
|
89 |
Done !
|