Class: SeoCache::PopulateCache

Inherits:
Object
  • Object
show all
Defined in:
lib/seo_cache/populate_cache.rb

Instance Method Summary collapse

Constructor Details

#initialize(host, paths, options = {}) ⇒ PopulateCache

Returns a new instance of PopulateCache.



8
9
10
11
12
13
14
15
16
# File 'lib/seo_cache/populate_cache.rb', line 8

def initialize(host, paths, options = {})
  @host         = host
  @paths        = paths
  @page_render  = PageRender.new
  @page_caching = PageCaching.new

  @force_cache      = options.fetch(:force_cache, false)
  @with_locale_keys = options.fetch(:with_locale_keys, false)
end

Instance Method Details

#performObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/seo_cache/populate_cache.rb', line 18

def perform
  if @with_locale_keys
    @paths.each do |locale, paths|
      paths.each do |path|
        generate_cache(path, locale)
      end
    end
  else
    @paths.each do |path|
      generate_cache(path)
    end
  end

ensure
  @page_render.close_connection
end