search for: expire_fragment

Displaying 20 results from an estimated 25 matches for "expire_fragment".

2007 Oct 21
4
Making 'expire_fragment' available to a model?
I noticed a lot of repetition across different Sweeper models in my app expiring the same fragments and so have been trying to move all the expire_fragment calls into another model which the sweepers can then use but it''s not working as I''d hoped.. I''ve created a CacheDestroyer model and want to be able to call something to the effect of: CacheDestroyer.clear_all_page_relations but I''m struggling to find how to mak...
2009 Feb 18
4
expire_fragment with memcached
Hello all, We know that memcached or memcached-client doesn''t support regex... But It seems it doesn''t support expire_fragment either :/ I''m trying to use expire_fragment with memcached as following : expire_fragment(:controller => ''home'', :action => :list_posts) But apparently it''s not supported by memcached : RuntimeError (Not supported by Memcache): /usr/lib/ruby/gems/1.8...
2005 Nov 04
1
expire_fragment outside of a controller
I am trying to figure out a way to call the expire_fragment outside of a controller. I need to expire some fragments on a hourly basis. I have a Thread that every hour that will perform a task. The expire_fragment is located in the module ActionController::Caching::Fragments as an instance method. Do I need to mixin the model ActionController::Caching::...
2006 Jan 16
0
expire_fragment problem
...39;',:action=>''additem_to_cart'',:action_suffix=>@user.id) %> At this point,rails has created 2 cache files correctly and everything works fine becuase I dont see rails making calls to the SQL db to get items from DB.Instead it uses cache. Now in def add_item_to_cart expire_fragment ( :controller=>''users'',:action=>''additem_to_cart'',:action_suffix=>@user.id) end When I call expire_fragment,Rails creates a new directory ''users'' and a new cache inside that directory but when rendering the view it still uses the old c...
2010 Sep 08
0
Re: Call expire_fragment from outside sweepers or controllers
...problem and managed to come up with a solution (albeit with a couple of limitations). My solution involves keeping all the code in the Sweeper and calling it via a class method, so it should work anywhere. See my blog entry for an explanation and the code. http://stevencummings.name/2010/09/07/expire_fragment-with-rake-and-as-a-model-only-observer -- Posted via http://www.ruby-forum.com/. -- 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.gman...
2006 Nov 04
0
#expire_fragment in models...any clean solutions?
I''ve seen a couple of workarounds on the mailing list related to expiring cached fragments inside of models, but nothing too clean. Anybody have any suggestions for handling this at the model-level? I have an application is updated outside of the Rails controllers, so I can''t use a Sweeper. The 2 methods I''ve seen: a. Use a callback to generate an HTTP post on a
2006 Jan 31
2
Fragment caching and pagination
I''m just getting my hands dirty with caching. The pages I want to cache have some user specific data on them (for example "log out"). That sent me down the route of fragment caching. One of the things I want to pagination is a paginated list. My question is how is pagination and query strings handled with fragment caching? Does each page get its own fragment and query string
2009 Dec 16
5
Caching comments: timestamps and subdomains
...ent cached fragments for www and non- www, as they''re exactly the same. I also want both the www and non-www page to expire. Should I do something like cache(:action => ''...'', :subdomain => false, :action_suffix => ''...'') and do the same for the expire_fragment part? Or is there a better solution? Thank you! -- 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 gro...
2006 May 21
0
expiring cache fragments using script/runner
I''ve just set up caching on my site and want to expire some of fragments on an hourly basis. I was going to use cron and script/runner to do this. For other fragments that I am expiring, I am using expire_fragment inside a sweeper class, something like: class QuestionSweeper < ActionController::Caching::Sweeper observe Question def after_validation_on_update(question) expire_page :controller => ''xml'', :action => ''question'', :id => question.id expi...
2008 Sep 28
4
Cannot expire cache from background process?
...r expiration) from a daemon that''s running in the background. The daemon is updating all kinds of important lists every few minutes from the background. So I have to find some way to DO or TRIGGER the fragment caching from this daemon. Unfortunately just using the normal commands like: expire_fragment :controller => ''groups'', :action => ''index'' from within the daemon triggers no reaction. Is there anyting I could change in the parameters I could add that would fix it? Using a sweeper is a problem because the daemon updates a lot of models but the cache...
2008 Mar 06
3
cache_sweeper
Hi, Why is cache_sweeper not a documented method? I was pretty sure it used to be, but I could be wrong. I can''t seem to find any information on it anymore in the online docs. As a side note, looking at the code for cache_sweeper it appears to only work with the :only option, not :except (ignores it)... what''s the reason for this? Thanks, Andrew
2006 Jan 21
1
clearing/expiring the ''index'' action.
Hi all, I''m having problems trying to expire the ''index'' action of a controller. In short, expire_action :action => ''index'' doesn''t work, but expire_fragment (url_for :action => ''index'').gsub(/\/index/,'''').split("://").last works fine and deletes the cached page as expected. I thought about this hack when I noticed that the cache for ''index'' is not stored in a directory named as the...
2006 Nov 04
0
Net::HTTP.post_form got 200 but no INSERT INTO. How come? How to fix this?
...0 OK , but i didn''t get my INSERT Query run ??? How can i fix it? Oh, btw here''s my new action method from my Blog2 controller def new @signature = Signature.new return unless request.post? @signature = Signature.new(params[:signature]) if @signature.save expire_fragment(:action => "list", :part => "signatures") expire_fragment(:action => "list", :part => "count") redirect_to(:action => "list") end end I would be verry grateful 4 somebody who can give me a good solution for this. -...
2006 Jun 28
7
caching objects
Hi, i just wanted to say my sorries in advance (sorrie/sorry/sorri)...i have just started learning about the subject of caching, but unfortunately haven''t effictively managed to implement what i had learned. obviously it''s possible to cache a whole page, or action with the caches_page :x or caches_action :y methods, but for some reason it hasn''t really worked with
2006 Jan 10
6
Can we cache user home pages?
Hi Railers, I am trying to create a simple application like a guest book which has users and uses sessions to keep track of which users are logged on. The user''s page is constructed after doing some SQL queries and the user clicks on another link and hits the back button I dont want to regenerate the whole page (which is what happens now) .So I want to use some kind of caching mechanism.
2006 Jul 19
11
Getting data from the database only once
Hi, I am a little bit new to ruby. I have a requirement that I need to get the data from the database. I need to do this many times in the whole application. But, I am looking for a way with which I can get the data from the database table only once and store it in some variable, and I can use it anywhere I want.(I am trying not to use the global variable for this purpose). Is there a way
2006 Feb 28
0
Rolled my own alternative to trigger function with OLD/NEW
...ctive, value) end def after_update if !get_old(''active'') and self.active Notifier::deliver_item_approved(self) end if get_old(''active'') != self.active Maintenance.delete_cache(''...'') # I wrote my own alternative to expire_fragment that actually works in models. Grumble... end end protected def get_old(value) @old[value] unless @old.nil? end def set_old(key, value) (@old ||= {})[key] = value end end Feel free to expound on it! I tested it out and didn''t get any nil errors (I''m s...
2006 Jan 25
1
cache_sweeper causes undefined method error
...s the sweeper class: class ItemSweeper < ActionController::Caching::Sweeper observe Item def after_create(item) expire_index item end def after_destroy(item) expire_index item end def after_update(item) expire_index item end private def expire_index(item) expire_fragment "#index_new_items_type#{item.type_id}" end end thanks for any help! csn -- Posted via http://www.ruby-forum.com/.
2005 Dec 16
0
memcached vs regex fragment expiry
Hi, I thought i''d give memcached a try. Installed it all, made the change in environment.rb and it all seems ok. I can telnet to memcached process and manually retrieve the data being cached. However, when I try to expire a fragment using a regex, eg: expire_fragment(%r{forums/recent/.*}) it throws an error: undefined method `delete_if'' for #<MemCache:0x2289968> I''m assuming i''m doing something stupid... Should the above work? Have I missed out a vital step? Oh well, back to the FileStore for now. :( ...j
2008 Apr 11
0
expiring cache outside controller (e.g. in rake tasks)
Hello, I need to expire cache outside controller, in my rake tasks. I want to use standard methods expire_fragment,etc.. but I can''t manage to use them outside controllers. I tried including ActiveController::Caching::Actions but didn''t work. Anyone has any solution? I''m losing my head how to do it... (besides manually deleting files) Thanks Uros --~--~---------~--~----~-----------...