开发者

Re-gain access to memory in a thread in Ruby?

In Ruby, is there a way to spin off a thread, store a variable inside, and then come back later, access the thread, and access the variable inside the thread?

Basically I need to store resources in some common memory pool. These can't be serialized or stored in Memcached. The problem I am facing is that I want to persist an FTP connection object across AJAX calls. I need to regain access to the connection object on t开发者_运维技巧he server-side end of multiple AJAX calls.


I ended up making this work using global variables (eg. $my_global). I have a ConnectionPooler singleton class which manages connections stored in a hash. Easy as pie.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜