Jeremax
Jeremax

Reputation: 41

GAE: know when data is put in Memcache

I want to know when data is put on Memcache ... Why ?

I have data in memcache with an expiration time of 30 minutes.

I want to update this data when someone ask after 5 minutes to the storage time.

Should I have to put 2 data like key=>data and key_time=>date or it's possible to know when data was store ?

I'm using Java.

Upvotes: 0

Views: 152

Answers (2)

Nick Johnson
Nick Johnson

Reputation: 101149

If you want to know when the data was written to memcache, simply store that information along with your data. For instance, instead of storing the value "foo" under the key "bar", store the tuple ("foo", current_timestamp), where current_timestamp is the time at which you're making the put request.

Upvotes: 0

Michael Gradek
Michael Gradek

Reputation: 2738

Key_time option can be hard to manage later. How will you find your key?

Its better to store it in a dictionary, i.e:

Key => {'time': time.time(), 'data': your_data}

Hope this helps.

Upvotes: 1

Related Questions