bug in memcache.set() with expiration time for 30 days?

133 views
Skip to first unread message

Andrius

unread,
Nov 5, 2011, 11:04:46 AM11/5/11
to Google App Engine
Hi,

if setting memcache entity to expire in 30 days (2592000 sec) it wont
set it, the gets will return nothing.
In documentation it says that the maximum time is 30 days, but it
doesn't say that entities will not be set.

Is this is a bug?

Andrius A

unread,
Nov 5, 2011, 11:29:02 AM11/5/11
to Google App Engine
ohh and memcache.set('myEntity', myData, 2592000) will return true!


--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To post to this group, send email to google-a...@googlegroups.com.
To unsubscribe from this group, send email to google-appengi...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.


pdknsk

unread,
Nov 5, 2011, 12:32:26 PM11/5/11
to Google App Engine
I haven't tried, but it probably doesn't work as a positional
argument, only as a keyword argument (time=1).

Andrius A

unread,
Nov 5, 2011, 1:27:53 PM11/5/11
to google-a...@googlegroups.com
even if specifying keyword it's not setting it:

memcache.set('myEntity', myData, 2592000) # returns True
memcache.get('myEntity') # returns None

memcache.set('myEntity', myData, 1209600) # returns True
memcache.get('myEntity') # returns entity data

Don't know really what's the logic here, maybe when time value is high it thinks this is a unix time stamp 2592000 = Sat, 31 Jan 1970 00:00:00 GMT, and makes data to expiry straight away? If so, documentation need to say that, because it is not clear!

On 5 November 2011 16:32, pdknsk <pdk...@googlemail.com> wrote:
I haven't tried, but it probably doesn't work as a positional
argument, only as a keyword argument (time=1).

Andrius A

unread,
Nov 5, 2011, 1:29:37 PM11/5/11
to google-a...@googlegroups.com
sorry, correct code:

memcache.set('myEntity', myData, time=2592000) # returns True
memcache.get('myEntity') # returns None

memcache.set('myEntity', myData, time=1209600) # returns True
memcache.get('myEntity') # returns entity data

Timofey Koolin

unread,
Nov 7, 2011, 11:33:24 AM11/7/11
to google-a...@googlegroups.com
you can set 0 or not set time - it mean maximum lifetime (1 month).
If you set full month - it can understand as timestamp in the past and value expire immendantly. Try set 29 days or 29 days 23 hours 59 minutes.

2011/11/5 Andrius A <andr...@gmail.com>



--
С уважением,
Кулин Тимофей.

Телефон: +7 (4852) 974793
ICQ: 114902104
email: tim...@koolin.ru
Blog: http://timofey.koolin.ru
Reply all
Reply to author
Forward
0 new messages