Hello, I have a dynamic website that i want to cache a piece of per user. There is a part of the page that makes a call to Yahoo Weather to pull the information down. Instead of making that call for every page load (same idea with google maps), i would like just to cache that fragment of the page. However each user has a different zip so i need to cache this on a per user level. Is this possible? thanks adam _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
Take a look at the documentation for fragment caching here: http://rails.rubyonrails.com/classes/ActionController/Caching/Fragments. html I think you could do something like this in your view to cache the weather results for each Zip code: <% cache(:action => "list", :action_suffix => @user.zipcode) do %> ... ________________________________ From: Adam Denenberg [mailto:straightflush-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] Sent: Monday, December 05, 2005 9:41 AM To: rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails] per user cache Hello, I have a dynamic website that i want to cache a piece of per user. There is a part of the page that makes a call to Yahoo Weather to pull the information down. Instead of making that call for every page load (same idea with google maps), i would like just to cache that fragment of the page. However each user has a different zip so i need to cache this on a per user level. Is this possible? thanks adam _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
does this need to be explicitly turned on in development? Its not workign so far for me. thanks adam On 12/5/05, Tom Fakes <Tom@tomandlisa.us> wrote:> > Take a look at the documentation for fragment caching here: > http://rails.rubyonrails.com/classes/ActionController/Caching/Fragments.html > > > > I think you could do something like this in your view to cache the weather > results for each Zip code: > > > > <% cache(:action => "list", :action_suffix => @user.zipcode) do %> > > … > > > > > > > > > ------------------------------ > > *From:* Adam Denenberg [mailto:straightflush@gmail.com] > *Sent:* Monday, December 05, 2005 9:41 AM > *To:* rails@lists.rubyonrails.org > *Subject:* [Rails] per user cache > > > > Hello, > > I have a dynamic website that i want to cache a piece of per user. There > is a part of the page that makes a call to Yahoo Weather to pull the > information down. Instead of making that call for every page load (same > idea with google maps), i would like just to cache that fragment of the > page. However each user has a different zip so i need to cache this on a > per user level. > > Is this possible? > > thanks > adam > > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails > > >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 12/6/05, Adam Denenberg <straightflush-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> does this need to be explicitly turned on in development? Its not workign so > far for me.I believe that caching is disabled in development mode. Or do you mean that it''s ''not working'' in a different way?> thanks > adamSincerely, Tom Lieber tom-V0YqjHVuocLQT0dZR+AlfA@public.gmane.org http://AllTom.com/