Re: [APC-DEV] Caching file_get_contents output inside APC (Performance improvement).
| From: | shire | Date: | Wed, 28 Oct 2009 07:56:41 +0000 |
| Subject: | Re: [APC-DEV] Caching file_get_contents output inside APC (Performance improvement). | ||
| References: | 1 2 3 | Groups: | php.pecl.dev php.apc.dev |
| Request: | Send a blank email to php-apc-dev+get-250@lists.php.net to get a copy of this message | ||
Hi Basant,
Basant Kukreja wrote:
On Mon, Oct 26, 2009 at 2:14 PM, Pierre Joye <pierre.php@gmail.com> wrote:Thanks for the patch/suggested feature but I tend to agree with Pierre's suggestion for handling this in user space. This is an extremely simple wrapper function to enable caching these values, and as your additional configuration items suggest, placing this functionality in APC creates some unnecessary complications and less flexibility for the PHP developer. The intention of the APC user cache is to allow extending it in PHP user space for caching any number of items like this, using the very method Pierre suggested. Heading in the direction you're suggesting would mean that APC should be responsible for caching all sorts of stream and file based activities that PHP and even other extensions could perform without knowing enough about the data to do it in an intelligent way. Unless you can provide reasons why the APC extension in particular is in a situation to handle this better than anything else, I don't see a compelling reason to start adding this type of functionality. -shire(pseudo code where my_cache* could be either APC user cache, memcached or other caching lib like Cache_Lite) if (!($cached = my_cache_get($key))) { $data = file_get_contents($path); my_cache_add($data, $ttl); }Probably it will perform close to the version I attached but mypoint is that application doesn't need to be modified and can use this feature by modifying configuration. More options which I think of which can be used to extend the caching feature :apc.cache_max_file_size # Maximum amount of files to be cachedapc.max_cache_use_bytes # Maximum amount of space to be occupied in cache.