object cache
| From: | Gareth Ardron | Date: | Sun, 01 Feb 2004 10:45:47 +0000 |
| Subject: | object cache | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-400@lists.php.net to get a copy of this message | ||
Ok, I'm just throwing this out to see if there's any interest in this going in pecl at all.
I do a lot of stuff with graphics manipulation through 'the web', specifically for http://fotopic.net. Now, as part of this, I often get called to create a page which will take an image from $source and output it at different resolutions or format's with various different filters or light-altering effects added. Now, fairly obviously, you don't really want to be actually generating each image every time a user views image.php, rather it'd be nice to have that cached.
I have been caching to disk, through php for a while now and using various other things like APC in order to speed this up, but what I've been really looking for is a way to, at the start of a script, check if an object exists in the cache, and if it does then simply grab the output as a handler and pipe the output to the user - alternativly, if it doesn't exist, run through the rest of the script and cache the end result before dumping to the end user.
Therefore, I've started to work on a module that'll do just this.
Essentially, you have ini values for max_memory and max_hdd space to be used as well as max_timeout. So it'll push things to memory first, but then chuck them out to hard disk if activity picks up. It's getting quite intelligent at spotting if a particualar object is called very frequently and making sure that that will stay in memory rather than going back and forth to hard dik space.
It's only about 50-60% complete at the moment. No dependancies to worry about. But would people be interested in this, or is it just one to stick up on freshmeat ?