Yes, of course there is otherwise this caching adapter would've been a waste
of time to implement into ZFW.

APC provides the same functionality as file caching, except that you can't
load an expired cache. But don't be mistaken, this doesn't mean you can't
renew an outdated cache (without it being expired). I'll explain it with a
simple example:

//--
// The trigger has been executed: remove the cache so that the cache will be
renewed
//--
if ( $contentHasBeenChanged )
   $cache->remove('somecache');

if ( !$result = $cache->load('somecache') )
{
   //--
   // The cache wasn't hit (there is no cache)
   // so re-execute the code and pass the result to the cache
   //--
}

// The rest..


In your case, I'd say give several backends a try and benchmark the result
to see which works best for you.

On Thu, Oct 2, 2008 at 2:13 PM, Michał Zieliński <[EMAIL PROTECTED]> wrote:

> But let`s  say I want to cache website with content which was updated. I
> don`t want to load cache with old data. I want to recreate the cache. Is
> there a way to do so? You wrote:
>
>
> I use APC (and soon Memcached) to cache medium to heavy query results, full
> pages, pieces of output, etc.
>
> so I assume you must handle with this issue.
> Sorry, for maybe silly, newbe questions but I`m quite new to this topic and
> I`m already greatly appreciated that you`ve helped me so much.
> I simply not sure if I understand this memory caching.
>
> My use case is typically for medium websites which provied text
> information in thousands of websites` sections which are either almost
> static (changes almost never like contact or history) or dynamic (like news
> or events).
> Now I`m caching everything in filesystem. If content in one section is
> changed the cache of this section is recreated (deleted old, create new)
> after saving the new data to DB. No matter if it`s static or not. Everything
> is read from cache and it works quite fast. But as you said, read from
> memory is much faster than from filesystem, so I`d definitely like to check
> this out.
> I just wonder if it`s the same process with memory as a backend cache
> system in case when data is suddenly changed and must be cached again.
>
> Really big thanks for your time and patience. You`re helping me very much.
>
> Best regards,
> Michał Zieliński
>
> mail: [EMAIL PROTECTED]
>
>
>
> 2008/10/2 Isaak Malik <[EMAIL PROTECTED]>
>
> It's not that you must prevent loading an expired cache with APC and
>> Memcached, it's just that you can't. The expired caches are automatically
>> removed from the adapter on the next call while e.g. with the filesystem as
>> backend the caches are only removed if you manually configured them to be
>> removed as soon as they expire. Whether you must recreate the cache manually
>> depends on your scripts, with full page caches for example you don't need to
>> recreate the as it is done automatically ($cache->start() does it) when
>> caching is enabled and no cache is hit.
>>
>> There is really nothing to worry about, as I say it just has some small
>> limitations.
>>
>> Note that the filesystem is quite slow itself (and keep fragmentation in
>> mind for Windows systems), much faster than using no cache but memory based
>> caching would be more profitable in most cases.
>> APC and Memcached are both caching adapters that use the memory instead of
>> the filesystem and obviously these would be the fastest. In my eyes the
>> filesystem is only good for really large files, I use APC (and soon
>> Memcached) to cache medium to heavy query results, full pages, pieces of
>> output, etc.
>>
>> Of course, all this greatly depends on how and for what you use caching.
>>
>>
>> On Thu, Oct 2, 2008 at 8:31 AM, Michał Zieliński <[EMAIL PROTECTED]>wrote:
>>
>>> Thanks a lot.
>>>
>>> So the only meaning of "Be careful : with this backend, "tags" are not
>>> supported" is that
>>> I must be worried not to load expired cache which means I must take care
>>> of the expiration datetime, right?
>>> If so, it seems that it shouldn`t be a problem. If something changes I
>>> remove the cache and recreate it manualy for the page, right?
>>> :-)
>>>
>>> I`m appreciated for this clarification.
>>> Now, my cache is based on files which works quite nice.
>>> However, I haven`t tested if other options give better boost. I heard
>>> that APC does.
>>>
>>> Regards,
>>> Michał Zieliński
>>>
>>> mail:       [EMAIL PROTECTED]
>>>
>>>
>>>
>>> W dniu 1 października 2008 18:58 użytkownik Isaak Malik <
>>> [EMAIL PROTECTED]> napisał:
>>>
>>> This is quite an old E-mail but here's some info if you still need it:
>>>>
>>>> It means that it's not possible to prevent a cache validity check which
>>>> means that you cannot $cache->load an expired APC/Memcached cache.
>>>>
>>>> It has its limitations.
>>>>
>>>> *E.g. You can't check if a cache is still valid when it has expired,
>>>> meaning you are obligated to re-create the cache every time it expired.
>>>> With adapters that support this flag you are able to load the expired
>>>> cache and renew it whenever you want (cronjob or a certain time of the 
>>>> day),
>>>> this gives you the opportunity to increase the performance of your apps 
>>>> even
>>>> more.*
>>>> *Of course you also have the choice to not let a cache expire but that
>>>> would cause problems if a cache gets outdated*.
>>>>
>>>> In my case: I'm using the APC adapter to cache entire pages with quite a
>>>> distant expiration time
>>>>
>>>> On Thu, Sep 4, 2008 at 9:32 AM, Michał Zieliński <[EMAIL PROTECTED]>wrote:
>>>>
>>>>>
>>>>> At the moment I`m storing cached data in files. It works fine.
>>>>> However I`d like to try out others adapters for APC or Memcache to
>>>>> speed
>>>>> some part of my app even more.
>>>>>
>>>>> In manual I read:
>>>>> Be careful : with this backend, "tags" are not supported for the moment
>>>>> as
>>>>> the "doNotTestCacheValidity=true" argument.
>>>>>
>>>>> There is no option for this backend.
>>>>>
>>>>> What exactly is this mean? What problems may I encounter? Is this that
>>>>> I
>>>>> better not cache some particular data like HTML files, Zend_Form
>>>>> output?
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Caching-backend-adapters-tp19304970p19304970.html
>>>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Isaak Malik
>>>> Web Developer
>>>>
>>>
>>>
>> --
>> Isaak Malik
>> Web Developer
>>
>
>

It's my pleasure to help :-)
-- 
Isaak Malik
Web Developer

Reply via email to