Skip to content

Commit

Permalink
Better cache expiration
Browse files Browse the repository at this point in the history
  • Loading branch information
epall committed Mar 15, 2010
1 parent 2aa2e62 commit bd15286
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
11 changes: 11 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,15 @@ class ApplicationController < ActionController::Base

# Scrub sensitive parameters from your log
# filter_parameter_logging :password

private

def expire_dynamic_pages(group)
expire_page :controller => :groups, :action => :show, :id => group.id
expire_page :controller => :groups, :action => :feed, :id => group.id
1.upto(10) do |n|
expire_page :controller => :groups, :action => :feed, :id => group.id, :page => n
end
expire_page :controller => :groups, :action => :dashboard, :id => group.id
end
end
4 changes: 1 addition & 3 deletions app/controllers/groups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def admin
def fetch
@group = Group.find(params[:id])
@group.fetch
expire_page :action => :show, :id => @group.id
expire_page :action => :feed, :id => @group.id
expire_page :action => :dashboard, :id => @group.id
expire_dynamic_pages(@group)
redirect_to :action => :dashboard, :id => @group.id
end

Expand Down
3 changes: 2 additions & 1 deletion app/controllers/projects_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def update
end

@project.update_attributes!(params[:project])
# @project.save!

expire_dynamic_pages(@project.group)

redirect_to :controller => 'groups', :action => 'show', :id => @project.group
end
Expand Down

0 comments on commit bd15286

Please sign in to comment.