Skip to content
Browse files

Improve robustness of Page#expire_page_caching for both ActiveSupport…

…::Cache::FileStore and ActiveSupport::Cache::MemoryStore
  • Loading branch information...
1 parent 4562f4d commit d1f56ae5f3ae697bafadeb3eb0ae2a3e7f0aac41 @zenchicken zenchicken committed Apr 1, 2011
Showing with 4 additions and 2 deletions.
  1. +4 −2 pages/app/models/page.rb
View
6 pages/app/models/page.rb
@@ -262,8 +262,10 @@ def use_marketable_urls?
end
def expire_page_caching
- if File.writable?(Rails.cache.cache_path)
- Pathname.glob(File.join(Rails.cache.cache_path, '**', '*pages*')).each(&:delete)
+ begin
+ Rails.cache.delete_matched(/.*pages.*/)
+ rescue NotImplementedError
+ # TODO Inform user that cache backing store can't help us here ...
end
end
end

0 comments on commit d1f56ae

Please sign in to comment.
Something went wrong with that request. Please try again.