File: apc_020.phpt

package info (click to toggle)
php-apcu 5.1.19%2B4.0.11-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,920 kB
  • sloc: ansic: 10,965; php: 1,736; xml: 903; pascal: 5; makefile: 2
file content (42 lines) | stat: -rw-r--r-- 802 bytes parent folder | download | duplicates (4)
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", "xxx");

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)