I have page handler with 95% traffic, it fetches model from DB using its key and then uses fields in the fetched model to fill a django template.
I want to memcache the fetched model so as to avoid DB reads. Not all fields of the model are used in template so i want to cache it with just the required feilds so as to improve cache utilization and fit more such models in cache.
So i want to convert the Model in a dictionary or ‘class boject’ with only the fields required in template.
Memcache uses pickle to serialize values, so for serialization purpose which will be faster dictionary or ‘class object’??
You need to measure but for all intended purposes the results should be that its about the same speed.
If any method tend to be faster I don’t really think its going to impact you overall performance that much.
Your main latency will be the RPC call to the memache which might be two factor slower then the slowest serialization.