1

I have a google app engine apps (created using python). I want to add a value to memcache but would like for the value to expire every midnight (PST) How do I do this?

N.P
  • 245
  • 1
  • 12

1 Answers1

5

You can set an item's expiration time either as absolute epoch time, or as a relative time-to-expire of up to one month. See http://code.google.com/appengine/docs/python/memcache/functions.html

There's a second alternative. If you have a set of known keys that you'd like to expire at a given time each day, use a cron job.

Dave W. Smith
  • 24,318
  • 4
  • 40
  • 46
  • I was having problems with the epoch time bit. I'll go with using a cron job to expire the keys. Thanks – N.P Oct 02 '11 at 22:11
  • @N.P There's really no need to waste your CPU time deleting them yourself - that's what the expiry time is _for_. – Nick Johnson Oct 04 '11 at 00:53