How do you share pre-calculated data between calls to a Rails web service?

Posted by Nigel Thorne on Stack Overflow See other posts from Stack Overflow or by Nigel Thorne
Published on 2010-05-19T04:52:07Z Indexed on 2010/05/19 5:00 UTC
Read the original article Hit count: 196

Filed under:
|
|
|
|

I have a Rails app that allows users to build up a network structure and then ask questions about how to navigate around it.

When adding nodes and connections these are just saved to the database. At the point you make a query of the network I calculate the shortest path from any node to any other node.

Constructing this in memory takes a while (something I need to fix), but once it is there, you can instantly get the answer to any of these path questions.

The question is... How do I share this network between calls to the website, so each request doesn't regenerate the paths network each time?

Note: I am hosting this on apache server using passenger (mod ruby)

Thoughts?

© Stack Overflow or respective owner

Related posts about ruby

Related posts about rails