Hi Andy and thank for reply,
The memcached expiration time is clear, everything which exceeds 30 days (in
seconds 60*60*24*30 = 2592000) it is treated like an Unix time stamp.
According to the memcached log I've got something like 'set
app_cake_model_default_aros_acos 1 86313600 699'
The magic number 86313600 I *think* it's the expiration value, 86313600 is
greater than 2592000 so it's treated like an Unix timestamp, date('Y-m-d
H:i:s', 86313600) = 1972-09-26 02:00:00 pretty much the same as
date('Y-m-d H:i:s', strtotime("+999 days") - time()) (part of the line from
source code I brought into discussion)
You have perfectly right, until I don't demonstrate this with an unit test,
the code is considered correct.
I see there is already a
test, cake/tests/cases/libs/cache/memcache.test.php, I'll run it and I'll
get back to you.
Thank you for your help,
Adrian
On Thu, Jan 13, 2011 at 2:14 PM, AD7six <[email protected]> wrote:
>
>
> On Jan 13, 1:01 pm, Adrian Arnautu <[email protected]> wrote:
> > Hi,
> >
> > I think I find the problem.
> > The keys like default_cake_sessions default_aros_acos default_acos and
> all
> > the models like default_MODEL_NAME have an expiration of '+999 days'
> >
> > In cake/libs/cache.php at line 238 we have
> > if (isset($settings['duration']) && !is_numeric($settings['duration'])) {
> > $settings['duration'] = strtotime($settings['duration']) - time();}
> >
> > which translates to: get me the timestamp for +999 days and then
> substract
> > from it the timestamp for current time which leaves 1970 + 999 days
>
> under what circumstances does strtotime return an invalid timestamp
> (1970 isn't a timestamp, and strtotime('+ 999 days') isn't 0 either) ?
>
> > which
> > invalidates my awsome memcache key/value. And of couse, if I'll use the
> file
> > cache probably it will be rewritten each and every time, I haven't test
> > this.
> > So far I don't know why that subtraction is there, why it is needed the
> > differernce as a result if someone can illuminate me, please do.
>
> does "duration" sound ike a timestamp to you?
>
> The docs for memcached would also make great reading:
> http://www.php.net/manual/en/memcached.expiration.php
>
> alternatively, create a test case that demonstrates something's
> broken :)
>
> AD
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
> more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en