In asp you have an Application built-in object, which works just like the Session hash, but it lets you share information among all users of a given application. which is the rails equivalent??? and if there isn''t, how would you implement such a thing ? (there would be concurrency issues to take into account, in fact asp''s application object has some lock and unlock methods to accomplish that) Saludos Sas -- Posted via http://www.ruby-forum.com/.
Kevin Olbrich
2006-Apr-11 15:56 UTC
[Rails] rails equivalent to asp''s Application object?
If you want globally visible data, why not just store it in a database table and load it when needed? On Tuesday, April 11, 2006, at 5:52 PM, sas sas wrote:> >In asp you have an Application built-in object, which works just like >the Session hash, but it lets you share information among all users of a >given application. > >which is the rails equivalent??? > >and if there isn''t, how would you implement such a thing ? (there would >be concurrencyissues to take into account, in fact asp''s application >object has some lock and unlock methods to accomplish that) > >Saludos > >Sas > >-- >Posted via http://www.ruby-forum.com/. >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails_Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Just out of curiousity, what do you use use the Application object for? Tim Case tim@karmacrash.com On 11 Apr 2006 15:56:02 -0000, Kevin Olbrich <devlists-rubyonrails@devlists.com> wrote:> If you want globally visible data, why not just store it in a database > table and load it when needed? > > > On Tuesday, April 11, 2006, at 5:52 PM, sas sas wrote: > > > >In asp you have an Application built-in object, which works just like > >the Session hash, but it lets you share information among all users of a > >given application. > > > >which is the rails equivalent??? > > > >and if there isn''t, how would you implement such a thing ? (there would > >be concurrencyissues to take into account, in fact asp''s application > >object has some lock and unlock methods to accomplish that) > > > >Saludos > > > >Sas > > > >-- > >Posted via http://www.ruby-forum.com/. > >_______________________________________________ > >Rails mailing list > >Rails@lists.rubyonrails.org > >http://lists.rubyonrails.org/mailman/listinfo/rails > > > _Kevin > > -- > Posted with http://DevLists.com. Sign up and save your mailbox. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Tim Case wrote:> Just out of curiousity, what do you use use the Application object for? >My guess is : system wide configuration options ? -- Posted via http://www.ruby-forum.com/.
Nuno wrote:> Tim Case wrote: >> Just out of curiousity, what do you use use the Application object for? >> > > My guess is : system wide configuration options ?good guess... But in asp I used it to implement a quick and dirty cache system (yeah yeah, I know, IT WON''T SCALE, but I use it for small amount of data) I''ll tell you a little more. Every acces to the DB goes thru an xml message. So I made a cahce system so that I relate some of those message with a key Imagine something like (i''m making it up, but it''ll let you understand) <xml> <object>city</object> <conditions> <condition>country_id=1</condition> </conditions> <user_id>234</user_id> </xml> This ends up calling some stored procedure like xmlCity_select I save a cache item object with a key "object:city,conditions:country_id=1" (I could use the whole xml message if I ignored the user_id tag), the result of the query (which is another xml) and an telling me it depends on the object city. So whenever I create/update/delete a city, I have to tell the cache system to get rid of every cache item depending on the object city. Obviously, it only works is every modificaction goes thru my app. Of course I don''t use it for every select clause, only for a few often used tables (like filling combos, the first page of several tables, and so on) It was quite easy to implement, it tok only a couple of hours, because I''ve already had a class that handles each and every xml request. I though that it could be used in rails to implement some kind of cache at the object level (whenever I issue a Country.find(24) go get it from the Cache, if it wasn''t modified) and at the sql level, this time comparing the whole sql sentence. All you have to do is invalidate the cache when anything changes. If you are caching more than one record, you have to do it on a table basis (say you cached the first then records, and someone inserted one at the beginning). It works great for statis or seldom changing data. Please take into account that I''m only begining to experiment with rails. And sometimes I wonder how can I acomplish things I''m used to do in other environments. So if you have any better ideas, please let me know. I still coulnd''t study in depth the view-level cache system, but I think it wouldn''t be so hard to implement it at the model or at the data level. Saludos and pardon the extension of this post Sas PS: This thing could be implemented in the session, on a per user basis, but it would certainly be a waste of memory. -- Posted via http://www.ruby-forum.com/.
Tom Mornini
2006-Apr-12 01:03 UTC
[Rails] Re: rails equivalent to asp''s Application object?
On Apr 11, 2006, at 5:57 PM, sas sas wrote:> Nuno wrote: >> Tim Case wrote: >>> Just out of curiousity, what do you use use the Application >>> object for? >>> >> >> My guess is : system wide configuration options ? > > good guess... > > But in asp I used it to implement a quick and dirty cache system (yeah > yeah, I know, IT WON''T SCALE, but I use it for small amount of data)Two things: 1) Premature optimization is the hobgoblin of little minds. :-) 2) Modern DBs have caching built in. 3) Rails has caching built in. -- -- Tom Mornini
sas sas
2006-Apr-12 01:17 UTC
[Rails] Re: Re: rails equivalent to asp''s Application object?
Tom Mornini wrote:> On Apr 11, 2006, at 5:57 PM, sas sas wrote: > >> But in asp I used it to implement a quick and dirty cache system (yeah >> yeah, I know, IT WON''T SCALE, but I use it for small amount of data) > > Two things: > > 1) Premature optimization is the hobgoblin of little minds. :-)I grant you it''s really premature now... it wasn''t when I had to implement it with asp...> 2) Modern DBs have caching built in.Yeap, but the data still has to go from one tier to another> 3) Rails has caching built in.You''re right, I''m being naughty, so I''ll RTFM ;-)> -- > -- Tom MorniniSaludos Sas -- Posted via http://www.ruby-forum.com/.
Kevin Olbrich
2006-Apr-12 03:17 UTC
[Rails] Re: rails equivalent to asp''s Application object?
Isn''t that 3 things? On Tuesday, April 11, 2006, at 6:03 PM, Tom Mornini wrote:>On Apr 11, 2006, at 5:57 PM, sas sas wrote: > >> Nuno wrote: >>> Tim Case wrote: >>>> Just out of curiousity, what do you use use the Application >>> >>>>object for? >>>> >>> >>> My guess is : system wide configuration options ? >> >> good guess... >> >> But in asp I used it to implement a quick and dirty cache system (yeah >> yeah, I know, IT WON''T SCALE, but I use it for small amount of data) > >Two things: > >1) Premature optimization is the hobgoblin of little minds. :-) > >2) Modern DBs have caching built in. > >3) Rails has caching built in. > >-- >-- Tom Mornini > >_______________________________________________ >Rails mailing list >Rails@lists.rubyonrails.org >http://lists.rubyonrails.org/mailman/listinfo/rails_Kevin -- Posted with http://DevLists.com. Sign up and save your mailbox.
Tom Mornini
2006-Apr-12 05:20 UTC
[Rails] Re: rails equivalent to asp''s Application object?
Sure is, I just couldn''t stop writing! :-) -- -- Tom Mornini On Apr 11, 2006, at 8:17 PM, Kevin Olbrich wrote:> Isn''t that 3 things? > > > On Tuesday, April 11, 2006, at 6:03 PM, Tom Mornini wrote: >> On Apr 11, 2006, at 5:57 PM, sas sas wrote: >> >>> Nuno wrote: >>>> Tim Case wrote: >>>>> Just out of curiousity, what do you use use the Application >>> >>>>> object for? >>>>> >>>> >>>> My guess is : system wide configuration options ? >>> >>> good guess... >>> >>> But in asp I used it to implement a quick and dirty cache system >>> (yeah >>> yeah, I know, IT WON''T SCALE, but I use it for small amount of data) >> >> Two things: >> >> 1) Premature optimization is the hobgoblin of little minds. :-) >> >> 2) Modern DBs have caching built in. >> >> 3) Rails has caching built in. >> >> -- >> -- Tom Mornini >> >> _______________________________________________ >> Rails mailing list >> Rails@lists.rubyonrails.org >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > _Kevin > > -- > Posted with http://DevLists.com. Sign up and save your mailbox. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Craig White
2006-Apr-12 13:16 UTC
[Rails] Re: rails equivalent to asp''s Application object?
I thought it was the result of premature optimization. Craig On Tue, 2006-04-11 at 22:20 -0700, Tom Mornini wrote:> Sure is, I just couldn''t stop writing! > > :-) > > -- > -- Tom Mornini > > On Apr 11, 2006, at 8:17 PM, Kevin Olbrich wrote: > > > Isn''t that 3 things? > > > > > > On Tuesday, April 11, 2006, at 6:03 PM, Tom Mornini wrote: > >> On Apr 11, 2006, at 5:57 PM, sas sas wrote: > >> > >>> Nuno wrote: > >>>> Tim Case wrote: > >>>>> Just out of curiousity, what do you use use the Application >>> > >>>>> object for? > >>>>> > >>>> > >>>> My guess is : system wide configuration options ? > >>> > >>> good guess... > >>> > >>> But in asp I used it to implement a quick and dirty cache system > >>> (yeah > >>> yeah, I know, IT WON''T SCALE, but I use it for small amount of data) > >> > >> Two things: > >> > >> 1) Premature optimization is the hobgoblin of little minds. :-) > >> > >> 2) Modern DBs have caching built in. > >> > >> 3) Rails has caching built in. > >> > >> -- > >> -- Tom Mornini > >> > >> _______________________________________________ > >> Rails mailing list > >> Rails@lists.rubyonrails.org > >> http://lists.rubyonrails.org/mailman/listinfo/rails > > > > > > _Kevin > > > > -- > > Posted with http://DevLists.com. Sign up and save your mailbox. > > _______________________________________________ > > Rails mailing list > > Rails@lists.rubyonrails.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails