[TYPO3-core] Bug with the calculation of cache expiry for pages

Bernd Wilke t3ng at pi-phi.tk
Tue May 8 14:00:12 CEST 2012


On 05/08/2012 12:55 PM, Jigal van Hemert wrote:
> Hi,
>
> On 8-5-2012 11:58, Bernd Wilke wrote:
>> in your solution you only use the endtime. is the starttime not
>> important too?
>
> The calculation is done in two steps. First we try to find the content
> elements on the page which can affect the cache expiry. For this only
> the endtime is relevant:
> - if the endtime is in the past, ignore content element; starttime
> should also be in the past
> - if endtime is in the future we have to look at the starttime and/or
> endtime
> - if endtime is zero, it means +infinite; still have to consider the
> starttime
>
> The second part of the calculation uses both endtime and starttime:
> - endtime is zero, ignore this (we start with a potential expiry of
> +infinite)
> - endtime non zero, consider this
> - starttime in the past, ignore this
> - starttime is zero, ignore it (means -infinite)
> - starttime in future, consider this
>
> The special meaning of zero in starttime and endtime makes things a bit
> complicated.
>
> Does this make sense to you?

why using a two stepped algotithm?
is it really faster than a query over more elements but without storing 
an intermedium result?

without a first selection, the second query just needs an additinal 
condition about endtime in the past to ignore this values too, to give 
the same result. you may simplify the query as for the starttime a value 
of zero is like being in the past.


following algorithm came to mind:

minimum from two selections:
min_(select min(starttime) from <table> where starttime > now() and 
<deciding contained elements>
     ,select min(endtime)   from <table> where endtime   > now() and 
<deciding contained elements>
     )
min_() may respect possible 0 values!

or:
min_( select min(max(starttime,now())),min(max(endtime,now())) from 
<table> where  <deciding contained elements> )

min_() may respect possible now() values!

bernd
-- 
http://www.pi-phi.de/cheatsheet.html


More information about the TYPO3-team-core mailing list