Php Memcached是否会减少对象';s键大小(当它为';更新了什么?
当下列memcached对象到达代码末尾时,其大小是否会改变Php Memcached是否会减少对象';s键大小(当它为';更新了什么?,php,architecture,nosql,memcached,Php,Architecture,Nosql,Memcached,当下列memcached对象到达代码末尾时,其大小是否会改变 <?php $m = new Memcached(); $m->addServer('localhost', 11211); $m->set('array', array(11, 12, 13, 14, 15, 16, 17, 18, 19, 20)); //Size in memory is X $m->set('array', array(11, 12)); //Size in memory is ?
<?php
$m = new Memcached();
$m->addServer('localhost', 11211);
$m->set('array', array(11, 12, 13, 14, 15, 16, 17, 18, 19, 20)); //Size in memory is X
$m->set('array', array(11, 12)); //Size in memory is ?
?>
是,它将减少内存 使用
memory\u get\u usage()打印内存使用情况代码>您将看到尊重
$m->set('array', array(11, 12, 13, 14, 15, 16, 17, 18, 19, 20));
$memory = memory_get_usage();
echo $memory ."<br>"; // it print 235368
$m->set('array', array(11, 12));
$memory = memory_get_usage();
echo $memory ."<br>"; // it print 235504
$m->set('array',array(11,12,13,14,15,16,17,18,19,20));
$memory=memory\u get\u usage();
echo$memory.“
”;//它打印235368
$m->set('array',array(11,12));
$memory=memory\u get\u usage();
echo$memory.“
”;//它打印235504
在你的服务器上试试