diff --git a/app/models/recent_documents_block.rb b/app/models/recent_documents_block.rb index 7b3fc7f..6173fac 100644 --- a/app/models/recent_documents_block.rb +++ b/app/models/recent_documents_block.rb @@ -32,8 +32,4 @@ class RecentDocumentsBlock < Block end end - def timeout - 2.months - end - end diff --git a/app/sweepers/block_sweeper.rb b/app/sweepers/block_sweeper.rb index fc8f0c0..41ae8a4 100644 --- a/app/sweepers/block_sweeper.rb +++ b/app/sweepers/block_sweeper.rb @@ -5,15 +5,14 @@ class BlockSweeper < ActiveRecord::Observer class << self include SweeperHelper - def cache_key_regex(block) + # Expire block's all languages cache + def expire_block(block) regex = '-[a-z]*$' clean_ck = block.cache_key.gsub(/#{regex}/,'') - %r{#{clean_ck+regex}} - end - # Expire block's all languages cache - def expire_block(block) - expire_timeout_fragment(cache_key_regex(block)) + Noosfero.locales.keys.each do |locale| + expire_timeout_fragment("#{clean_ck}-#{locale}") + end end def expire_blocks(blocks) -- libgit2 0.21.2