Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-09 16:13:03 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-07-09 16:13:03 +0300
commit0d83ca4ff8727de409f91009ec7739f68cb3a877 (patch)
tree0c14091c7a221d1966f969353a9fe9a60465588a
parent5309dad4599310a50883366c9cdf866465a89f11 (diff)
parent635ffe4841a850a074ff189a1791b64884af9621 (diff)
Merge branch 'cache-readme' into 'master'
Cache readme rendering result Markdown rendering is expensive. Lets cahce result Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> See merge request !947
-rw-r--r--app/helpers/projects_helper.rb4
-rw-r--r--app/views/projects/show.html.haml3
2 files changed, 6 insertions, 1 deletions
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index df1d630c89d..cef23a52e34 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -272,4 +272,8 @@ module ProjectsHelper
current_user.recent_push(@project.id)
end
end
+
+ def readme_cache_key
+ [@project.id, @project.commit.sha, "readme"].join('-')
+ end
end
diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml
index d9cff805575..19ac6dacf7d 100644
--- a/app/views/projects/show.html.haml
+++ b/app/views/projects/show.html.haml
@@ -49,7 +49,8 @@
%i.fa.fa-file
= readme.name
.wiki
- = render_readme(readme)
+ = cache(readme_cache_key) do
+ = render_readme(readme)
- else
%h3.page-title
This project does not have README yet