Class: Locomotive::Steam::LiquidParserWithCacheService

Inherits:
LiquidParserService
  • Object
show all
Defined in:
lib/locomotive/steam/services/liquid_parser_with_cache_service.rb

Constant Summary collapse

UNMARSHALABLE_OPTIONS =
%i(parser page parent_finder snippet_finder section_finder).freeze

Instance Method Summary collapse

Instance Method Details

#cache_key(page) ⇒ Object


16
17
18
# File 'lib/locomotive/steam/services/liquid_parser_with_cache_service.rb', line 16

def cache_key(page)
  "#{Locomotive::VERSION}/site/#{current_site._id}/template/#{current_site.template_version.to_i}/page/#{page._id}/#{locale}"
end

#parse(page) ⇒ Object


10
11
12
13
14
# File 'lib/locomotive/steam/services/liquid_parser_with_cache_service.rb', line 10

def parse(page)
  return super unless current_site.cache_enabled

  read_template_from_cache(page) || write_template_in_cache(page, super)
end