joerussbowman / gaeutilities

gaeutilities - A collection of utilities to help with application development on Google Appengine
http://gaeutilities.appspot.com
BSD 3-Clause "New" or "Revised" License
78 stars 4 forks source link

Detect entities and store a reference rather than pickling it #13

Closed joerussbowman closed 14 years ago

joerussbowman commented 14 years ago

Stumbled on this during routine searching for gaeutilities

http://osdir.com/ml/GoogleAppEngine/2010-03/msg00302.html

The easy solution is to check and see if an object is a datastore entity when storing it in the session. If it is, then we should store the entity key and automatically look it up on access.

dound commented 14 years ago

Depending on whether the session user frequently references the entity from the session, it might be faster to avoid extra database gets and just store a raw protobuf with your session.

joerussbowman commented 14 years ago

You know, it looks like at some point someone (maybe me? I don't remember) actually did get serializing model entities with protobufs in, and there's a test in the demo even.