1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-11 16:01:56 +00:00

Page caching set up

This commit is contained in:
2015-12-23 14:11:20 +00:00
parent be1df55e39
commit db876809ef
6 changed files with 109 additions and 94 deletions

View File

@@ -45,6 +45,7 @@ gem 'spring', :group => :development
gem 'passenger' gem 'passenger'
gem 'therubyracer' gem 'therubyracer'
gem 'newrelic_rpm' gem 'newrelic_rpm'
gem 'dalli'
end end
#Other #Other
gem 'devise' gem 'devise'

View File

@@ -48,6 +48,7 @@ GEM
execjs execjs
coffee-script-source (1.9.1.1) coffee-script-source (1.9.1.1)
concurrent-ruby (1.0.0) concurrent-ruby (1.0.0)
dalli (2.7.5)
devise (3.4.1) devise (3.4.1)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
@@ -160,6 +161,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
cancancan cancancan
coffee-rails (~> 4.0.0) coffee-rails (~> 4.0.0)
dalli
devise devise
jbuilder (~> 2.0) jbuilder (~> 2.0)
jquery-rails jquery-rails

View File

@@ -1,7 +1,7 @@
class Match < ActiveRecord::Base class Match < ActiveRecord::Base
belongs_to :tournament belongs_to :tournament, touch: true
belongs_to :weight belongs_to :weight, touch: true
belongs_to :mat belongs_to :mat, touch: true
has_many :wrestlers, :through => :weight has_many :wrestlers, :through => :weight
after_save do after_save do

View File

@@ -1,3 +1,4 @@
<% cache ["brackets", @weight] do %>
</br> </br>
</br> </br>
</br> </br>
@@ -21,3 +22,4 @@
<% if @bracketType == "fourPoolsToSemi" %> <% if @bracketType == "fourPoolsToSemi" %>
<%= render 'fourPoolSemiBracket' %> <%= render 'fourPoolSemiBracket' %>
<% end %> <% end %>
<% end %>

View File

@@ -1,3 +1,4 @@
<% cache ["up_matches", @tournament] do %>
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default"%> <%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default"%>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
@@ -68,3 +69,4 @@
</table> </table>
<br> <br>
<% end %>

View File

@@ -54,6 +54,14 @@ Wrestling::Application.configure do
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store # config.cache_store = :mem_cache_store
config.cache_store = :dalli_store,
(ENV["MEMCACHIER_SERVERS"] || "").split(","),
{:username => ENV["MEMCACHIER_USERNAME"],
:password => ENV["MEMCACHIER_PASSWORD"],
:failover => true,
:socket_timeout => 1.5,
:socket_failure_delay => 0.2
}
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = "http://assets.example.com" # config.action_controller.asset_host = "http://assets.example.com"