﻿__group__,ticket,summary,component,milestone,type,created,_description_,_changetime,_reporter
moo,95,Memory is not free()'d after xcache_get() data is unset,cacher,3.1.0,defect,2007-05-15T08:41:33+02:00,"I've tested EA vs XCache performance on cache reads and got the following problem:

Code:
{{{
#!php
<?php
	function ea_read ($max) # void
	{
		global $DATA;

		for($i = 0;$i<10;$i++)
		{
			$key[$i] = 'some_key_'.$i;
			eaccelerator_put($key[$i], $DATA);
		}

		for($i = 0;$i<$max;$i++)
			$val = eaccelerator_get($key[$i%10]);
	}

	function xcache_read ($max) # void
	{
		global $DATA;

		for($i = 0;$i<10;$i++)
		{
			$key[$i] = 'some_key_'.$i;
			xcache_set($key[$i], $DATA);
		}

		for($i = 0;$i<$max;$i++)
		{
			$val = xcache_get($key[$i%10]);
		}
	}
}}}
Result ($max = 10000):
{{{
#!php
<?php
    $DATA = str_repat('x',10000); 
}}}
Everything is ok.
{{{
#!php
<?php
    $DATA = array_map('uniqid', range(1,10));
}}}
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 15 bytes).

It seems that XCache somehow marks array items that they aren't released (may be it increases ref_count?). I tried to add ""unset($val);"" after ""$val = xcache_get();"" but it didn't help.

The only solution I've found is:
{{{
#!php
<?php
   xcache_set($key,serialize($data));
   $val = unserialize(xcache_get($key));
}}}
but it looks weird (and slows down xcache calls) ...",2013-05-20T18:46:58+02:00,krogot
moo,300,Error on PHP files containing multiple namespaces when XCache is enabled,cacher,3.0.2,defect,2013-02-19T16:31:36+01:00,"This was first reported over there: https://github.com/nrk/predis/issues/80 but it seems to be a problem with XCache, not this specific library.

If I enable xcache on my apache server, Predis throws the following error:
""Fatal error: Class 'Predis\CommunicationException' not found in...""

I am using the one-file version of Predis (not really my choice, the application I use Predis with is a bit rigid).
It should be noted this has been reproduced on two different machines.
Disabling XCache as an extension or disabling the caching engine fix the issue. 

The issue is present in XCache 3.0.1 too.

PHP version:

PHP 5.3.10-1ubuntu3.2 with Suhosin-Patch (cli) (built: Jun 13 2012 17:19:58) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with XCache v1.3.2, Copyright (c) 2005-2011, by mOo

OS:
Distributor ID: Ubuntu
Description: Ubuntu 12.04.1 LTS
Release: 12.04
Codename: precise

Apache:
Server version: Apache/2.2.22 (Ubuntu)
Server built: Feb 13 2012 01:51:50

Predis Client version is 0.7.4-dev

Thank you very much for your time.",2013-05-21T09:34:05+02:00,adrienlabelle
moo,176,xcache_isset support XC_TYPE_PHP,cacher,4.0.0,defect,2008-05-10T21:57:49+02:00,"Why xcache_isset do not support check, if a specific php file is cached or not?
Can be secure and more faster than file_exists before includes.
",2012-07-13T17:10:48+02:00,anonymous
moo,289,class loading fails using stream_wrapper_register for the file:// protocol with xcache enabled,cacher,undecided,defect,2012-09-25T12:14:25+02:00,"I am using a proxy filestream wrapper which takes notes of modifying file operations. For each operation it unregisters it self and executes the operation using the respective php function, and than registers it self again as the wrapper for the file:// protocol.

As soon as xcache is enabled, and the proxy wrapper is used, php fails to load the file wrapper class in  stream_wrapper_register('file', __CLASS__)

I concluded that xcache should use the &php_plain_files_wrapper and not a class which can't get loaded because the stream wrapper is unregistered just before that.

I wrote a small patch for the 2.0.1 version which enables the &php_plain_files_wrapper for xcache and restores the original as soon as xcache is done compiling of the php code

gcc version: gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
php version: PHP 5.3.5-0.dotdeb.1 with Suhosin-Patch (built: Jan 18 2011 13:18:29)",2012-09-26T15:14:40+02:00,ferengee
moo,179,xcache_set/get Multiple Keys,cacher,3.1.0,enhancement,2008-05-31T17:17:18+02:00,"一般情况下，在执行的 PHP 脚本中，很少会只用一次两次的 var cache。

都会这么写：
foreach ($data AS $key => $value)
{
    xcache_set($key, $value, $ttl);
}

xcache_get 也基本上差不多，尤其在把数据库的记录当作一个 key -> value 对存在的时候，往往做一个列表页的情况下，会进行很大批量的 get 和 set 操作。从性能开销的考虑来看，由 xcache 支持批量操作，速度会提升 5-10 倍。目前 APC 和 MEMCACHE 的 get 操作都支持批量 key 的存取。我想除了方便的角度，也有性能提升的考虑吧。

我设想增加 xcache_gets API，原型为：

array xcache_gets(array $keys, [array &$unget_keys])

变量 keys 为一批 key，变量 unget_keys 为在缓存中未获得到的 key 的数组。方便后期代码中进行数据的获取，而不需要再进行循环操作。

如果可以的话，也可以增加 xcache_sets 函数，原型为：

bool xcache_sets(array $data, $ttl)

变量 $data 为 key -> $value 对。

以上建议请希望开发者慎重考虑～",2013-05-20T18:46:59+02:00,paulgao@…
moo,241,Compiled Code For eval(),cacher,4.0.0,enhancement,2010-04-26T09:11:57+02:00,"The biggest performance issue we see these days is there is no good way to eval compiled code.

It would be *really* nice if XCache could intercept eval() calls, generate a md5 hash based on the code to be run, compile that code with the md5 as the internal key if the key isn't already compiled/stored in memory.  Then execute the compiled version of the code.",2012-03-26T14:37:54+02:00,digitalpoint
moo,242,xcache_get() For Multiple Keys,cacher,4.0.0,enhancement,2010-04-28T21:59:13+02:00,"It would be really nice if xcache_get() worked in a similar fashion to how Memcache:get() works...

http://www.php.net/manual/en/function.memcache-get.php

If you pass it a string, it returns the key requested (just like xcache_get() currently works), but if you pass it an array, it will return an array of those keys.  So you are able to optionally get a bunch of keys in one pass.  Changing how it works if you passed an array to it should be backwardly compatible since it would still work the same if you pass a string to it.",2012-07-16T11:04:23+02:00,digitalpoint
moo,253,lazy stat (was: reduce the number of fstat call to help server on SAN and network file servers),cacher,3.1.0,enhancement,2010-10-19T20:32:04+02:00,"Adding a parameter to indicate a modification time check delay for php opcode cache can help reduce the load for php server with root directory on a SAN or any network file system. The fstat cost with such setup is much higher than on local filesystem.

This can be implemented this way:

Adding a struct member with the last m_time check in the cache entry.
Check this entry and compare it with the request time, if the last check is within the specified delay (10 seconds for example), use the cache entry as is.
If the last check time is older, read the m_time, update the last check time and do the timestamp compare as now.

",2013-05-20T18:46:59+02:00,sam@…
moo,268,choosing specified cache slot for xcache_set,cacher,3.1.0,enhancement,2011-12-08T17:52:52+01:00,"I would like to suggest an optional paramter for xcache_set to specify a certain variable cache (var#0, var#1 etc).  

For me and maybe others it would be very useful, because I am caching one information object that is very large and many small ones. If I were able to specify the variable cache, I could ensure that the 
large object and the small objects stay in different caches. Otherwise the small objects may end up in positions, so that there is not enough continuous room left for the large object. ",2013-05-20T18:46:59+02:00,digi1
