File: 009.phpt

package info (click to toggle)
php-yac 2.0.1%2B0.9.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 548 kB
  • ctags: 565
  • sloc: ansic: 4,581; xml: 298; makefile: 1
file content (39 lines) | stat: -rw-r--r-- 792 bytes parent folder | download | duplicates (10)
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
--TEST--
Check for yac multi ops
--SKIPIF--
<?php if (!extension_loaded("yac")) print "skip"; ?>
--INI--
yac.enable=1
yac.enable_cli=1
yac.keys_memory_size=4M
yac.values_memory_size=32M
--FILE--
<?php 
$yac = new Yac();

$values = array();
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 0; $i < 100; $i++) {
    $key = substr(str_shuffle($chars), 0, rand(16, 32));
    $value = md5($key . rand(1, 10000));
    $values[$key] = $value;
}

$numbers = count($values);

var_dump($yac->set($values));

$keys = array_keys($values);
$ret = $yac->get($keys);
var_dump(count(array_filter($ret)) == $numbers);

$disable = array_slice($keys, 0, -10);
$yac->delete($disable);

$ret = $yac->get($keys);
var_dump(count(array_filter($ret)) == 10);
?>
--EXPECTF--
bool(true)
bool(true)
bool(true)