NYCPHP Meetup

NYPHP.org

[nycphp-talk] Cache package suggestions

Cliff Hirsch cliff at pinestream.com
Fri Aug 17 13:24:19 EDT 2007


On 8/17/07 12:57 PM, "Rob Marscher" <rmarscher at beaffinitive.com> wrote:
>> I¹m reviewing caching packages and am looking for suggestions.
>> Smarty cache ‹ since I use Smarty anyway...
>> PEAR cachelite ‹ looks simple and efficient. Could be good for caching small
>> ³widgets², misc paramters, etc.
> 
> Both of these are file based, so you have some disk i/o overhead.  I've used
> both.  Smarty is oriented a bit more towards page output caching, but I don't
> see why it wouldn't be possible to store anything else... you just need to
> appropriately serialize the data to a string.  Cache_Lite has more methods for
> dealing with other types of data.
> 
>> ZendFramework Zend_Cache ‹ multiple backend storage options is nice, but may
>> be overkill for my needs ‹ until I realize I need memcached of course.
> This one gets my vote because of the multiple backend options - APC, Memcache,
> ZendPlatform, SQLite, and file based.  Only SQLite and file-based backends
> support the "tag" grouping - but it's not that important a feature. I would
> say don't use tagging so you can easily switch the backends.  Also, I don't
> really see how it's anymore overkill than PEAR.  You don't need to include the
> whole framework as demonstrated in this article.
> http://devzone.zend.com/node/view/id/1221
> 
>> Also... All packages generally store cache results based on a lifetime. But
>> what if I want to store results using a date, not a lifetime. An example
>> would be something that changes once per day. Ideally, I¹d like this updated
>> for the first hit after midnight each day. Suggestions?
> Use a lifetime of 86400 and manually invalidate it sometime after midnight. 
> It's not reliable that it would stay always at the same time.  You could set
> no expire time for the cache (or a really huge expire time if your cache
> system requires an expiration) and then have a cron process that runs after
> midnight and updates the cache programmatically.  That's probably better.
> 
> -Rob

Great suggestions. Time to dig more deeply into ZendCache. Another
suggestion I received offline regarding the midnight issue is to dynamically
calculate the lifetime to midnight for each request. But this does add some
calculation overhead for each request.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070817/a9ecbc7a/attachment.html>


More information about the talk mailing list