fastentry 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4ffb7fee4f850a17d31f6d58e4a7bb9d84a3f8a888a347ecadeabd9b2067bc91
4
- data.tar.gz: b99ef0e91dddb47b7faabe61accb73d26d63ab04e6b313b4048b47abd79a35af
3
+ metadata.gz: ecbd37d8850658d30c3a6a90636cd2e7cbbacbc6c5fbecd61775bbf956d8fe28
4
+ data.tar.gz: 553ec75607dc303af1019ae94f3f93558687bb1bac1ff702ec86fa646bf1433c
5
5
  SHA512:
6
- metadata.gz: 0eed835e7bec9a59780c264df7e79abb96162f82b85b1b0e4c1b8b87c10a736148622c97a171b8c829e07abada6fe749ddb41e2d344fcd2de1285e86ae438853
7
- data.tar.gz: 2ba61a581751eb7df15044ceb935c345f8003ffcc62d59656191a02e521bdeb235dba25caf320d1a80d6471e702fe6fe9b216400c2e5767d6647f572f5860919
6
+ metadata.gz: 0dd3d9145f2693b3cff2669dcc1c022ef777174887606dc3879a27bdbbc4aeb2f500e447042ec6565b57e495b2b8c61065a82394ee2585de2760911b92d52b32
7
+ data.tar.gz: 73b390298321c738cc0844c10d267047343cbc223a20e49f671e7e18c850992d016957b0da63e2682a8358ab1ea5970733683307a482fd3ef2ec164f076b7724
@@ -1,8 +1,10 @@
1
1
  module Fastentry
2
2
  class CacheController < ApplicationController
3
3
  def show
4
- key = params[:key]
5
- @cache_item = Rails.cache.read(key)
4
+ @key = params[:key]
5
+ expiration_date = Rails.cache.send(:read_entry, @key, {}).expires_at
6
+ @expiration = (Time.at(expiration_date).strftime("%a, %e %b %Y %H:%M:%S %z") if expiration_date.present?)
7
+ @cache_item = Rails.cache.read(@key)
6
8
  end
7
9
 
8
10
  def invalidate
@@ -0,0 +1,7 @@
1
+ module Fastentry
2
+ class StatsController < ApplicationController
3
+ def index
4
+ @number_of_keys = Rails.cache.instance_variable_get(:@data).keys.count
5
+ end
6
+ end
7
+ end
@@ -1,5 +1,18 @@
1
1
  <section class="section">
2
2
  <div class="container">
3
- <%= ap(@cache_item).html_safe %>
3
+ <%= link_to "< Back", root_url, class: "button is-small", style: "margin-bottom: 30px;" %>
4
+
5
+ <div>
6
+ <p class="heading">Key</p>
7
+ <p class="subtitle"><%= @key %></p>
8
+
9
+ <% if @expiration %>
10
+ <p class="heading">Expiration</p>
11
+ <p class="subtitle"><%= @expiration %></p>
12
+ <% end %>
13
+
14
+ <p class="heading">Content</p>
15
+ <%= ap(@cache_item).html_safe %>
16
+ </div>
4
17
  </div>
5
18
  </section>
@@ -0,0 +1,12 @@
1
+ <section class="section">
2
+ <div class="container">
3
+ <nav class="level">
4
+ <div class="level-item has-text-centered">
5
+ <div>
6
+ <p class="heading">Number of keys</p>
7
+ <p class="title"><%= @number_of_keys %></p>
8
+ </div>
9
+ </div>
10
+ </nav>
11
+ </div>
12
+ </section>
@@ -29,6 +29,9 @@
29
29
  <a class="navbar-item" href="<%= root_path %>">
30
30
  Dashboard
31
31
  </a>
32
+ <a class="navbar-item" href="<%= stats_path %>">
33
+ Stats
34
+ </a>
32
35
  </div>
33
36
  </div>
34
37
  </div>
data/config/routes.rb CHANGED
@@ -5,4 +5,6 @@ Fastentry::Engine.routes.draw do
5
5
 
6
6
  get "cache_item/:key" => "cache#show", as: "cache"
7
7
  delete "invalidate/:key" => "cache#invalidate", as: "invalidate_key"
8
+
9
+ resources :stats, only: [:index]
8
10
  end
@@ -3,7 +3,7 @@ module Fastentry
3
3
  isolate_namespace Fastentry
4
4
 
5
5
  initializer "engine_name.assets.precompile" do |app|
6
- app.config.assets.precompile += %w( fastentry/logo.png )
6
+ app.config.assets.precompile += %w( fastentry/logo.png fastentry/applications.css application.js )
7
7
  end
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module Fastentry
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastentry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Alves
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-11 00:00:00.000000000 Z
11
+ date: 2019-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -56,12 +56,14 @@ files:
56
56
  - app/controllers/fastentry/application_controller.rb
57
57
  - app/controllers/fastentry/cache_controller.rb
58
58
  - app/controllers/fastentry/dashboard_controller.rb
59
+ - app/controllers/fastentry/stats_controller.rb
59
60
  - app/helpers/fastentry/application_helper.rb
60
61
  - app/jobs/fastentry/application_job.rb
61
62
  - app/mailers/fastentry/application_mailer.rb
62
63
  - app/models/fastentry/application_record.rb
63
64
  - app/views/fastentry/cache/show.html.erb
64
65
  - app/views/fastentry/dashboard/index.html.erb
66
+ - app/views/fastentry/stats/index.html.erb
65
67
  - app/views/layouts/fastentry/application.html.erb
66
68
  - config/routes.rb
67
69
  - lib/fastentry.rb