summaryrefslogtreecommitdiff
path: root/app/models/milestone.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-10-07 08:52:26 +0000
committerRobert Speicher <robert@gitlab.com>2016-10-07 08:52:26 +0000
commita17412f0aa9ef9c99a5c136906ea8a585326c27d (patch)
tree4e0d7171e0e9d6f57e151341d8b57328e4376ad1 /app/models/milestone.rb
parentc2cf1dd6c771ee3a181fa9704da593daa825c58a (diff)
parent110e15da260f96baffb48bebb8cba796374fbb1e (diff)
downloadgitlab-ce-a17412f0aa9ef9c99a5c136906ea8a585326c27d.tar.gz
Merge branch '18337-cache-html-in-database' into 'master'
Cache rendered Markdown fields in the database ## What does this MR do? Introduces cache fields for Markdown-containing fields in the database, and populates them. ## Why was this MR needed? Rendering Markdown into HTML is performance-intensive. A Redis cache already exists, but this approach is expected to be more performant and reduce unnecessary cache invalidations. ## What are the relevant issue numbers? Closes #18337 See merge request !6095
Diffstat (limited to 'app/models/milestone.rb')
-rw-r--r--app/models/milestone.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/milestone.rb b/app/models/milestone.rb
index 44c3cbb2c73..23aecbfa3a6 100644
--- a/app/models/milestone.rb
+++ b/app/models/milestone.rb
@@ -6,12 +6,16 @@ class Milestone < ActiveRecord::Base
Any = MilestoneStruct.new('Any Milestone', '', -1)
Upcoming = MilestoneStruct.new('Upcoming', '#upcoming', -2)
+ include CacheMarkdownField
include InternalId
include Sortable
include Referable
include StripAttribute
include Milestoneish
+ cache_markdown_field :title, pipeline: :single_line
+ cache_markdown_field :description
+
belongs_to :project
has_many :issues
has_many :labels, -> { distinct.reorder('labels.title') }, through: :issues