google-app-enginepython-memcached

How can I set a value in memcache to expire at a specific time?


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?


Solution

  • 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.