Commit 4c1538a9465304acc22502f12199d2e2b360cb81
1 parent
40f18681
Exists in
master
and in
4 other branches
Use redis as cache storage. cache events
Showing
4 changed files
with
33 additions
and
12 deletions
Show diff stats
Gemfile
@@ -103,6 +103,9 @@ gem 'settingslogic' | @@ -103,6 +103,9 @@ gem 'settingslogic' | ||
103 | gem "foreman" | 103 | gem "foreman" |
104 | gem "git" | 104 | gem "git" |
105 | 105 | ||
106 | +# Cache | ||
107 | +gem "redis-rails" | ||
108 | + | ||
106 | group :assets do | 109 | group :assets do |
107 | gem "sass-rails", "~> 3.2.5" | 110 | gem "sass-rails", "~> 3.2.5" |
108 | gem "coffee-rails", "~> 3.2.2" | 111 | gem "coffee-rails", "~> 3.2.2" |
Gemfile.lock
@@ -329,8 +329,24 @@ GEM | @@ -329,8 +329,24 @@ GEM | ||
329 | json (~> 1.4) | 329 | json (~> 1.4) |
330 | redcarpet (2.2.2) | 330 | redcarpet (2.2.2) |
331 | redis (3.0.2) | 331 | redis (3.0.2) |
332 | + redis-actionpack (3.2.3) | ||
333 | + actionpack (~> 3.2.3) | ||
334 | + redis-rack (~> 1.4.0) | ||
335 | + redis-store (~> 1.1.0) | ||
336 | + redis-activesupport (3.2.3) | ||
337 | + activesupport (~> 3.2.3) | ||
338 | + redis-store (~> 1.1.0) | ||
332 | redis-namespace (1.2.1) | 339 | redis-namespace (1.2.1) |
333 | redis (~> 3.0.0) | 340 | redis (~> 3.0.0) |
341 | + redis-rack (1.4.2) | ||
342 | + rack (~> 1.4.1) | ||
343 | + redis-store (~> 1.1.0) | ||
344 | + redis-rails (3.2.3) | ||
345 | + redis-actionpack (~> 3.2.3) | ||
346 | + redis-activesupport (~> 3.2.3) | ||
347 | + redis-store (~> 1.1.0) | ||
348 | + redis-store (1.1.3) | ||
349 | + redis (>= 2.2.0) | ||
334 | request_store (1.0.5) | 350 | request_store (1.0.5) |
335 | rspec (2.12.0) | 351 | rspec (2.12.0) |
336 | rspec-core (~> 2.12.0) | 352 | rspec-core (~> 2.12.0) |
@@ -504,6 +520,7 @@ DEPENDENCIES | @@ -504,6 +520,7 @@ DEPENDENCIES | ||
504 | rb-fsevent | 520 | rb-fsevent |
505 | rb-inotify | 521 | rb-inotify |
506 | redcarpet (~> 2.2.2) | 522 | redcarpet (~> 2.2.2) |
523 | + redis-rails | ||
507 | rspec-rails (= 2.12.2) | 524 | rspec-rails (= 2.12.2) |
508 | sass-rails (~> 3.2.5) | 525 | sass-rails (~> 3.2.5) |
509 | sdoc | 526 | sdoc |
app/views/events/_event.html.haml
1 | - if event.proper? | 1 | - if event.proper? |
2 | - %div.event-item | ||
3 | - %span.cgray.pull-right | ||
4 | - #{time_ago_in_words(event.created_at)} ago. | 2 | + = cache event do |
3 | + %div.event-item | ||
4 | + %span.cgray.pull-right | ||
5 | + #{time_ago_in_words(event.created_at)} ago. | ||
5 | 6 | ||
6 | - = image_tag gravatar_icon(event.author_email), class: "avatar s24" | 7 | + = image_tag gravatar_icon(event.author_email), class: "avatar s24" |
7 | 8 | ||
8 | - - if event.push? | ||
9 | - = render "events/event/push", event: event | ||
10 | - .clearfix | ||
11 | - - elsif event.note? | ||
12 | - = render "events/event/note", event: event | ||
13 | - - else | ||
14 | - = render "events/event/common", event: event | 9 | + - if event.push? |
10 | + = render "events/event/push", event: event | ||
11 | + .clearfix | ||
12 | + - elsif event.note? | ||
13 | + = render "events/event/note", event: event | ||
14 | + - else | ||
15 | + = render "events/event/common", event: event | ||
15 | 16 |
config/environments/production.rb
@@ -40,7 +40,7 @@ Gitlab::Application.configure do | @@ -40,7 +40,7 @@ Gitlab::Application.configure do | ||
40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) | 40 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) |
41 | 41 | ||
42 | # Use a different cache store in production | 42 | # Use a different cache store in production |
43 | - config.cache_store = :memory_store | 43 | + config.cache_store = :redis_store |
44 | 44 | ||
45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server | 45 | # Enable serving of images, stylesheets, and JavaScripts from an asset server |
46 | # config.action_controller.asset_host = "http://assets.example.com" | 46 | # config.action_controller.asset_host = "http://assets.example.com" |