forked from krakjoe/apcu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapc_020.phpt
42 lines (36 loc) · 818 Bytes
/
apc_020.phpt
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
--TEST--
Test default expunge logic wrt global and per-entry TTLs
--SKIPIF--
<?php
require_once(__DIR__ . '/skipif.inc');
if (!function_exists('apcu_inc_request_time')) die('skip APC debug build required');
?>
--INI--
apc.enabled=1
apc.enable_cli=1
apc.use_request_time=1
apc.ttl=1
apc.shm_size=1M
--FILE--
<?php
apcu_store("no_ttl_unaccessed", 12);
apcu_store("no_ttl_accessed", 24);
apcu_store("ttl", 42, 3);
apcu_store("dummy", str_repeat('x', 1000));
apcu_inc_request_time(1);
apcu_fetch("no_ttl_accessed");
apcu_inc_request_time(1);
// Fill the cache
$i = 0;
while (apcu_exists("dummy")) {
apcu_store("key" . $i, str_repeat('x', 500));
$i++;
}
var_dump(apcu_fetch("no_ttl_unaccessed"));
var_dump(apcu_fetch("no_ttl_accessed"));
var_dump(apcu_fetch("ttl"));
?>
--EXPECT--
bool(false)
int(24)
int(42)