Module: QA_Rails::ContentMarkdownCache

Extended by:
ActiveSupport::Concern
Included in:
QAReply, QATopic
Defined in:
lib/qa-rails.rb

Instance Method Summary collapse

Instance Method Details

#_content_markdown_cacheObject



8
9
10
11
12
13
14
15
16
# File 'lib/qa-rails.rb', line 8

def _content_markdown_cache
  seconds = Rails.env == 'development' ? 1.second : 5.minutes
  key     = "/json/#{self.class.table_name}/#{self.id}/_content_markdown_cache"
  Rails.cache.fetch(key, :expires_in => seconds) do
    c = MarkdownTopicConverter.format(self.content.to_s)
    puts self.content.inspect, " - "*8, c
    c
  end
end