0

I have an object with an __init__ procedure that requires at least one parameter and

I want to store in the cache.

When trying to getting the object from the cache I get an error that the I didn't pass enough parameters to the ___init___ method.

Someone told me I need to pickle the object before sending it to the cache but all the examples I saw were using .dat files and on appengine you cannot use any file system.

2
  • 1
    You do not need to pickle an object before storing it in memcache. May 3, 2011 at 14:41
  • You need to include some sample code that reproduces your problem. We can't tell what you could be doing just from the description you've given. May 3, 2011 at 16:19

2 Answers 2

3

You can use pickle without any filesystem, using pickle.loads / pickle.dumps. For example:

import pickle
obj = YourClass(yourparam=...)
data = pickle.dumps(obj)
# and now, store "data" into the cache

# later, get "data" from the cache
obj = pickle.loads(data)

# and tada, obj if the same as before :)
0

I think you are trying to use memcache in appengine. This blog will help you a lot

http://blog.notdot.net/2009/9/Efficient-model-memcaching

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.