I was developing a Push System with Tornado. As i'm taking long polling, i need to keep a list of Future Object in order to set results for them later. Then i want to keep the Future list in Redis, so i 'dumps' each Future with Pickle module and set it to Redis, But after i get it from Redis, and 'loads' it. I found it was not the original Future Object, and when i invoke set_result function on this future object, it doesn't work as my expectation.
Any one can help me on this?
This is the part of my code:
@singleton
class MessageProxy:
def register_subscriber(self, subscriber):
r.set("subscriber", pickle.dumps(subscriber))
def send_message(self, message):
subscriber = pickle.loads(r.get("subscriber"))
subscriber.set_result(message.content)