Problem : Instance Variable or Application Constant Expiring I am parsing an XML, and getting a response object which is quite large ,hence I cant store that in Session or cookie. I can not regenerate this response as its from a 3rd party Web service . Regeneration would spoil the flow of the application. I have used 3 approaches . @instance_variable @@class_variable $CONSTANT Limitations: Application doesn''t have a - Database - Filestore system Can someone please let me know a solution by which I can persist a large string around 10000 to 25000 characters throughout the application, also which is user specific and not same for all users. To repeat: I need a way by which I can store a large data(10k -25K characters) throughout the application. Approach I followed: Like mentioned above I have used a $CONSTANT or @@class_variable , this approach works fine with mongrel/webrick both locally or on server(linux). however the same piece of code fails on passenger . RAILS version (3.0.3 and 3.1.0) Ruby (1.9.2) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Nov-17 07:54 UTC
Re: Problem : Instance Variable or Application Constant Expiring
On Nov 17, 6:21 am, CJ <mba.piyushgu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Problem : Instance Variable or Application Constant Expiring > > I am parsing an XML, and getting a response object which is quite > large ,hence I cant store that in Session or cookie. > I can not regenerate this response as its from a 3rd party Web > service . Regeneration would spoil the flow of the application. > > I have used 3 approaches . > @instance_variable > @@class_variable > $CONSTANT > > Limitations: > Application doesn''t have a > - Database > - Filestore system > > Can someone please let me know a solution by which I can persist a > large string around 10000 to 25000 characters throughout the > application, also which is user specific and not same for all users. > > To repeat: I need a way by which I can store a large data(10k -25K > characters) throughout the application. >Or how can you persist something without persistent storage ? The only thing I can thing of would be to send that response object through to the user and use html5 local storage to store it there, but really I''d look at overturning one of those limitations (Could you run memcache?) Fred> Approach I followed: > Like mentioned above I have used a $CONSTANT or @@class_variable , > this approach works fine with mongrel/webrick both locally or on > server(linux). however the same piece of code fails on passenger . > > RAILS version (3.0.3 and 3.1.0) > Ruby (1.9.2)-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Matt Jones
2011-Nov-17 12:48 UTC
Re: Problem : Instance Variable or Application Constant Expiring
CJ wrote:> Problem : Instance Variable or Application Constant Expiring > > I am parsing an XML, and getting a response object which is quite > large ,hence I cant store that in Session or cookie. > I can not regenerate this response as its from a 3rd party Web > service . Regeneration would spoil the flow of the application. > > I have used 3 approaches . > @instance_variable > @@class_variable > $CONSTANTDon''t use ANY of these. As you''ve already noticed, they fail badly for any solution that involves more than one process answering requests.> > Limitations: > Application doesn''t have a > - Database > - Filestore systemWow, that kinda sucks. :)> Can someone please let me know a solution by which I can persist a > large string around 10000 to 25000 characters throughout the > application, also which is user specific and not same for all users.Short of doing something horribly icky like "put a hidden field on every page and make all actions use POST", I''m not certain there''s a good solution for this. --Matt Jones -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.