mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +00:00
Page caching set up
This commit is contained in:
5
Gemfile
5
Gemfile
@@ -42,9 +42,10 @@ gem 'spring', :group => :development
|
|||||||
group :production do
|
group :production do
|
||||||
gem 'rails_12factor'
|
gem 'rails_12factor'
|
||||||
gem 'mysql2'
|
gem 'mysql2'
|
||||||
gem 'passenger'
|
gem 'passenger'
|
||||||
gem 'therubyracer'
|
gem 'therubyracer'
|
||||||
gem 'newrelic_rpm'
|
gem 'newrelic_rpm'
|
||||||
|
gem 'dalli'
|
||||||
end
|
end
|
||||||
#Other
|
#Other
|
||||||
gem 'devise'
|
gem 'devise'
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -1,23 +1,25 @@
|
|||||||
</br>
|
<% cache ["brackets", @weight] do %>
|
||||||
</br>
|
</br>
|
||||||
</br>
|
</br>
|
||||||
|
</br>
|
||||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
|
|
||||||
<br>
|
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default" %>
|
||||||
<br>
|
<br>
|
||||||
<h1><%= @weight.max %> lbs Bracket</h1>
|
<br>
|
||||||
|
<h1><%= @weight.max %> lbs Bracket</h1>
|
||||||
<%= render 'pool' %>
|
|
||||||
|
<%= render 'pool' %>
|
||||||
<% if @bracketType == "twoPoolsToFinal" %>
|
|
||||||
<%= render 'twoPoolFinalBracket' %>
|
<% if @bracketType == "twoPoolsToFinal" %>
|
||||||
<% end %>
|
<%= render 'twoPoolFinalBracket' %>
|
||||||
<% if @bracketType == "twoPoolsToSemi" %>
|
<% end %>
|
||||||
<%= render 'twoPoolSemiBracket' %>
|
<% if @bracketType == "twoPoolsToSemi" %>
|
||||||
<% end %>
|
<%= render 'twoPoolSemiBracket' %>
|
||||||
<% if @bracketType == "fourPoolsToQuarter" %>
|
<% end %>
|
||||||
<%= render 'fourPoolQuarterBracket' %>
|
<% if @bracketType == "fourPoolsToQuarter" %>
|
||||||
<% end %>
|
<%= render 'fourPoolQuarterBracket' %>
|
||||||
<% if @bracketType == "fourPoolsToSemi" %>
|
<% end %>
|
||||||
<%= render 'fourPoolSemiBracket' %>
|
<% if @bracketType == "fourPoolsToSemi" %>
|
||||||
<% end %>
|
<%= render 'fourPoolSemiBracket' %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
@@ -1,70 +1,72 @@
|
|||||||
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default"%>
|
<% cache ["up_matches", @tournament] do %>
|
||||||
<script>
|
<%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}", :class=>"btn btn-default"%>
|
||||||
$(document).ready(function() {
|
<script>
|
||||||
$('#matchList').dataTable();
|
$(document).ready(function() {
|
||||||
} );
|
$('#matchList').dataTable();
|
||||||
</script>
|
} );
|
||||||
<script>
|
</script>
|
||||||
setTimeout("location.reload(true);",30000);
|
<script>
|
||||||
</script>
|
setTimeout("location.reload(true);",30000);
|
||||||
<br>
|
</script>
|
||||||
<br>
|
<br>
|
||||||
<h5 style="color:red">This page reloads every 30s</h5>
|
<br>
|
||||||
<br>
|
<h5 style="color:red">This page reloads every 30s</h5>
|
||||||
<br>
|
<br>
|
||||||
<h3>Upcoming Matches</h3>
|
<br>
|
||||||
<br>
|
<h3>Upcoming Matches</h3>
|
||||||
<br>
|
<br>
|
||||||
<table class="table table-striped table-bordered">
|
<br>
|
||||||
<thead>
|
<table class="table table-striped table-bordered">
|
||||||
<tr>
|
<thead>
|
||||||
<th>Mat</th>
|
|
||||||
<th>On Mat</th>
|
|
||||||
<th>On Deck</th>
|
|
||||||
<th>In The Hole</th>
|
|
||||||
<th>Warm Up</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
|
|
||||||
<tbody>
|
|
||||||
<% @mats.each.map do |m| %>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= m.name %></td>
|
<th>Mat</th>
|
||||||
<td><% if m.unfinishedMatches.first %><%=m.unfinishedMatches.first.bout_number%><br><%= m.unfinishedMatches.first.w1_name %> vs. <%= m.unfinishedMatches.first.w2_name %><% end %></td>
|
<th>On Mat</th>
|
||||||
<td><% if m.unfinishedMatches.second %><%=m.unfinishedMatches.second.bout_number%><br><%= m.unfinishedMatches.second.w1_name %> vs. <%= m.unfinishedMatches.second.w2_name %><% end %></td>
|
<th>On Deck</th>
|
||||||
<td><% if m.unfinishedMatches.third %><%=m.unfinishedMatches.third.bout_number%><br><%= m.unfinishedMatches.third.w1_name %> vs. <%= m.unfinishedMatches.third.w2_name %><% end %></td>
|
<th>In The Hole</th>
|
||||||
<td><% if m.unfinishedMatches.fourth %><%=m.unfinishedMatches.fourth.bout_number%><br><%= m.unfinishedMatches.fourth.w1_name %> vs. <%= m.unfinishedMatches.fourth.w2_name %><% end %></td>
|
<th>Warm Up</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
</thead>
|
||||||
</tbody>
|
|
||||||
</table>
|
<tbody>
|
||||||
<br>
|
<% @mats.each.map do |m| %>
|
||||||
<br>
|
<tr>
|
||||||
<h3>Matches not assigned</h3>
|
<td><%= m.name %></td>
|
||||||
<br>
|
<td><% if m.unfinishedMatches.first %><%=m.unfinishedMatches.first.bout_number%><br><%= m.unfinishedMatches.first.w1_name %> vs. <%= m.unfinishedMatches.first.w2_name %><% end %></td>
|
||||||
<br>
|
<td><% if m.unfinishedMatches.second %><%=m.unfinishedMatches.second.bout_number%><br><%= m.unfinishedMatches.second.w1_name %> vs. <%= m.unfinishedMatches.second.w2_name %><% end %></td>
|
||||||
<table class="display compact cell-border" id="matchList">
|
<td><% if m.unfinishedMatches.third %><%=m.unfinishedMatches.third.bout_number%><br><%= m.unfinishedMatches.third.w1_name %> vs. <%= m.unfinishedMatches.third.w2_name %><% end %></td>
|
||||||
<thead>
|
<td><% if m.unfinishedMatches.fourth %><%=m.unfinishedMatches.fourth.bout_number%><br><%= m.unfinishedMatches.fourth.w1_name %> vs. <%= m.unfinishedMatches.fourth.w2_name %><% end %></td>
|
||||||
<tr>
|
</tr>
|
||||||
<th>Round</th>
|
<% end %>
|
||||||
<th>Bout Number</th>
|
</tbody>
|
||||||
<th>Weight Class</th>
|
</table>
|
||||||
<th>Matchup</th>
|
<br>
|
||||||
</tr>
|
<br>
|
||||||
</thead>
|
<h3>Matches not assigned</h3>
|
||||||
|
<br>
|
||||||
<tbody>
|
<br>
|
||||||
<% if @matches.size > 0 %>
|
<table class="display compact cell-border" id="matchList">
|
||||||
<% @matches.each.map do |m| %>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Round <%= m.round %></td>
|
<th>Round</th>
|
||||||
<td><%= m.bout_number %></td>
|
<th>Bout Number</th>
|
||||||
<td><%= m.weight_max %> lbs</td>
|
<th>Weight Class</th>
|
||||||
<td><%= m.w1_name %> vs. <%= m.w2_name %></td>
|
<th>Matchup</th>
|
||||||
</tr>
|
</tr>
|
||||||
<% end %>
|
</thead>
|
||||||
<% end %>
|
|
||||||
</tbody>
|
<tbody>
|
||||||
</table>
|
<% if @matches.size > 0 %>
|
||||||
|
<% @matches.each.map do |m| %>
|
||||||
<br>
|
<tr>
|
||||||
|
<td>Round <%= m.round %></td>
|
||||||
|
<td><%= m.bout_number %></td>
|
||||||
|
<td><%= m.weight_max %> lbs</td>
|
||||||
|
<td><%= m.w1_name %> vs. <%= m.w2_name %></td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user