开发者

With Resque, how can you pass objects that are not JSON serializable to jobs if they aren't in your database?

I'm creating an IMAP object in one job a开发者_Python百科nd need to pass it to other jobs in Resque. What's the best way to pass the IMAP object since it's not serializable?


There is no way to pass it directly to Resque. However, you can setup another persistence mechanism to store the object until the worker executes the job.

You could pretty easily setup a memcached store in Ruby/Rails and pass the string key to the job. When the job executes it would deserialize from memcached and expire the key.

Not really a recommended way to do things (because caching typically doesn't guarantee the Object staying around until access), but if you have hard dependencies on Resque and IMAP serialization then it can be a solution.


There is no way to cache/serialize NET objects due to the inherit nature of TCP connections (keeping track of client, server, time etc).

Is there any way you can extract and serialize the data within that object and send that to the other jobs?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜