Application Context in Rails

Posted by Sean McMains on Stack Overflow See other posts from Stack Overflow or by Sean McMains
Published on 2008-09-20T18:33:44Z Indexed on 2010/04/28 21:57 UTC
Read the original article Hit count: 401

Rails comes with a handy session hash into which we can cram stuff to our heart's content. I would, however, like something like ASP's application context, which instead of sharing data only within a single session, will share it with all sessions in the same application. I'm writing a simple dashboard app, and would like to pull data every 5 minutes, rather than every 5 minutes for each session.

I could, of course, store the cache update times in a database, but so far haven't needed to set up a database for this app, and would love to avoid that dependency if possible.

So, is there any way to get (or simulate) this sort of thing? If there's no way to do it without a database, is there any kind of "fake" database engine that comes with Rails, runs in memory, but doesn't bother persisting data between restarts?

© Stack Overflow or respective owner

Related posts about web-development

Related posts about ruby-on-rails