mission_control-cache 0.1.0

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.
Files changed (31) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +51 -0
  4. data/Rakefile +8 -0
  5. data/app/assets/stylesheets/mission_control/cache/application.css +15 -0
  6. data/app/assets/stylesheets/mission_control/cache/tailwind.css +64 -0
  7. data/app/assets/stylesheets/solid_cache/dashboard/application.css +15 -0
  8. data/app/assets/stylesheets/solid_cache/dashboard/tailwind.css +64 -0
  9. data/app/controllers/mission_control/cache/application_controller.rb +15 -0
  10. data/app/controllers/mission_control/cache/dashboard_controller.rb +30 -0
  11. data/app/controllers/solid_cache/dashboard/application_controller.rb +15 -0
  12. data/app/controllers/solid_cache/dashboard/dashboard_controller.rb +30 -0
  13. data/app/helpers/mission_control/cache/application_helper.rb +6 -0
  14. data/app/helpers/solid_cache/dashboard/application_helper.rb +6 -0
  15. data/app/jobs/solid_cache/dashboard/application_job.rb +6 -0
  16. data/app/mailers/solid_cache/dashboard/application_mailer.rb +8 -0
  17. data/app/models/solid_cache/dashboard/application_record.rb +7 -0
  18. data/app/views/layouts/mission_control/cache/application.html.erb +17 -0
  19. data/app/views/layouts/solid_cache/dashboard/application.html.erb +17 -0
  20. data/app/views/mission_control/cache/dashboard/index.html.erb +53 -0
  21. data/app/views/solid_cache/dashboard/dashboard/index.html.erb +53 -0
  22. data/config/routes.rb +3 -0
  23. data/lib/mission_control/cache/engine.rb +28 -0
  24. data/lib/mission_control/cache/version.rb +5 -0
  25. data/lib/mission_control/cache.rb +9 -0
  26. data/lib/mission_control-cache.rb +1 -0
  27. data/lib/solid_cache/dashboard/engine.rb +28 -0
  28. data/lib/solid_cache/dashboard/version.rb +5 -0
  29. data/lib/solid_cache/dashboard.rb +9 -0
  30. data/lib/tasks/solid_cache/dashboard_tasks.rake +4 -0
  31. metadata +411 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 94fe9612597857ad9f882ca1f054df1d2a566441a30747abfa71a13572239286
4
+ data.tar.gz: 7047bcb02e22f62e91716af9f89fdae39a943f94bdf4484618fbd93e6f8a4e15
5
+ SHA512:
6
+ metadata.gz: 7de29be029bc01ac851ce54b4d128b0ad7c7ffeec68f50541fe5a89db960c68e07feca8e73ec4f07b7c2f9e560db5b297365bfb7e20e696920705b7b2080805c
7
+ data.tar.gz: 9879f24607eaa8a8b8b663bda3ca364a0c6267ee540997c9175b681c8f95f45b637c7082cee48d51b987ce988abe75a7130e2c9151d7b8a8a950f9ab622c0da5
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright Gabriel
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,51 @@
1
+ # MissionControl::Cache
2
+ A Mission Control dashboard for monitoring and managing SolidCache.
3
+
4
+ ## Usage
5
+
6
+ After installing the gem, mount the engine in your Rails application's routes:
7
+
8
+ ```ruby
9
+ # config/routes.rb
10
+ Rails.application.routes.draw do
11
+ mount MissionControl::Cache::Engine => "/cache"
12
+
13
+ # Your other routes...
14
+ end
15
+ ```
16
+
17
+ This will make the dashboard available at `/cache` in your application.
18
+
19
+ ### Configuration
20
+
21
+ Make sure SolidCache is properly configured in your application:
22
+
23
+ ```ruby
24
+ # config/initializers/solid_cache.rb
25
+ Rails.application.config.solid_cache.backend = :redis
26
+ Rails.application.config.solid_cache.namespace = "your_app_cache"
27
+ Rails.application.config.solid_cache.expires_in = 1.hour
28
+ ```
29
+
30
+ ## Installation
31
+ Add this line to your application's Gemfile:
32
+
33
+ ```ruby
34
+ gem "mission_control-cache"
35
+ ```
36
+
37
+ And then execute:
38
+ ```bash
39
+ $ bundle
40
+ ```
41
+
42
+ Or install it yourself as:
43
+ ```bash
44
+ $ gem install mission_control-cache
45
+ ```
46
+
47
+ ## Contributing
48
+ Contribution directions go here.
49
+
50
+ ## License
51
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ require "bundler/setup"
2
+
3
+ APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
4
+ load "rails/tasks/engine.rake"
5
+
6
+ load "rails/tasks/statistics.rake"
7
+
8
+ require "bundler/gem_tasks"
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,64 @@
1
+ /* Tailwind-like utility classes */
2
+ .container { width: 100%; max-width: 1200px; margin-left: auto; margin-right: auto; }
3
+ .mx-auto { margin-left: auto; margin-right: auto; }
4
+ .px-4 { padding-left: 1rem; padding-right: 1rem; }
5
+ .py-8 { padding-top: 2rem; padding-bottom: 2rem; }
6
+ .p-4 { padding: 1rem; }
7
+ .p-6 { padding: 1.5rem; }
8
+ .mb-4 { margin-bottom: 1rem; }
9
+ .mb-6 { margin-bottom: 1.5rem; }
10
+ .text-2xl { font-size: 1.5rem; line-height: 2rem; }
11
+ .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
12
+ .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
13
+ .font-bold { font-weight: 700; }
14
+ .font-semibold { font-weight: 600; }
15
+ .font-medium { font-weight: 500; }
16
+ .bg-white { background-color: #ffffff; }
17
+ .bg-blue-50 { background-color: #eff6ff; }
18
+ .bg-green-50 { background-color: #ecfdf5; }
19
+ .bg-purple-50 { background-color: #f5f3ff; }
20
+ .bg-gray-50 { background-color: #f9fafb; }
21
+ .text-blue-800 { color: #1e40af; }
22
+ .text-green-800 { color: #065f46; }
23
+ .text-purple-800 { color: #5b21b6; }
24
+ .text-gray-500 { color: #6b7280; }
25
+ .text-gray-900 { color: #111827; }
26
+ .shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
27
+ .rounded-lg { border-radius: 0.5rem; }
28
+ .grid { display: grid; }
29
+ .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
30
+ .gap-4 { gap: 1rem; }
31
+ .overflow-x-auto { overflow-x: auto; }
32
+ .min-w-full { min-width: 100%; }
33
+ .divide-y { border-top-width: 1px; border-bottom-width: 1px; }
34
+ .divide-gray-200 { border-color: #e5e7eb; }
35
+ .whitespace-nowrap { white-space: nowrap; }
36
+ .uppercase { text-transform: uppercase; }
37
+ .tracking-wider { letter-spacing: 0.05em; }
38
+ .text-left { text-align: left; }
39
+ .text-center { text-align: center; }
40
+ .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
41
+ .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
42
+ .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
43
+
44
+ /* Responsive utilities */
45
+ @media (min-width: 768px) {
46
+ .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
47
+ }
48
+
49
+ /* General styling */
50
+ body {
51
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
52
+ line-height: 1.5;
53
+ color: #374151;
54
+ background-color: #f3f4f6;
55
+ }
56
+
57
+ table {
58
+ border-collapse: collapse;
59
+ width: 100%;
60
+ }
61
+
62
+ th {
63
+ font-weight: 500;
64
+ }
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,64 @@
1
+ /* Tailwind-like utility classes */
2
+ .container { width: 100%; max-width: 1200px; margin-left: auto; margin-right: auto; }
3
+ .mx-auto { margin-left: auto; margin-right: auto; }
4
+ .px-4 { padding-left: 1rem; padding-right: 1rem; }
5
+ .py-8 { padding-top: 2rem; padding-bottom: 2rem; }
6
+ .p-4 { padding: 1rem; }
7
+ .p-6 { padding: 1.5rem; }
8
+ .mb-4 { margin-bottom: 1rem; }
9
+ .mb-6 { margin-bottom: 1.5rem; }
10
+ .text-2xl { font-size: 1.5rem; line-height: 2rem; }
11
+ .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
12
+ .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
13
+ .font-bold { font-weight: 700; }
14
+ .font-semibold { font-weight: 600; }
15
+ .font-medium { font-weight: 500; }
16
+ .bg-white { background-color: #ffffff; }
17
+ .bg-blue-50 { background-color: #eff6ff; }
18
+ .bg-green-50 { background-color: #ecfdf5; }
19
+ .bg-purple-50 { background-color: #f5f3ff; }
20
+ .bg-gray-50 { background-color: #f9fafb; }
21
+ .text-blue-800 { color: #1e40af; }
22
+ .text-green-800 { color: #065f46; }
23
+ .text-purple-800 { color: #5b21b6; }
24
+ .text-gray-500 { color: #6b7280; }
25
+ .text-gray-900 { color: #111827; }
26
+ .shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
27
+ .rounded-lg { border-radius: 0.5rem; }
28
+ .grid { display: grid; }
29
+ .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
30
+ .gap-4 { gap: 1rem; }
31
+ .overflow-x-auto { overflow-x: auto; }
32
+ .min-w-full { min-width: 100%; }
33
+ .divide-y { border-top-width: 1px; border-bottom-width: 1px; }
34
+ .divide-gray-200 { border-color: #e5e7eb; }
35
+ .whitespace-nowrap { white-space: nowrap; }
36
+ .uppercase { text-transform: uppercase; }
37
+ .tracking-wider { letter-spacing: 0.05em; }
38
+ .text-left { text-align: left; }
39
+ .text-center { text-align: center; }
40
+ .px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
41
+ .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
42
+ .py-4 { padding-top: 1rem; padding-bottom: 1rem; }
43
+
44
+ /* Responsive utilities */
45
+ @media (min-width: 768px) {
46
+ .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
47
+ }
48
+
49
+ /* General styling */
50
+ body {
51
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
52
+ line-height: 1.5;
53
+ color: #374151;
54
+ background-color: #f3f4f6;
55
+ }
56
+
57
+ table {
58
+ border-collapse: collapse;
59
+ width: 100%;
60
+ }
61
+
62
+ th {
63
+ font-weight: 500;
64
+ }
@@ -0,0 +1,15 @@
1
+ module MissionControl
2
+ module Cache
3
+ class ApplicationController < ActionController::Base
4
+ ActionController::Base::MODULES.each do |mod|
5
+ include mod unless self < mod
6
+ end
7
+
8
+ layout "mission_control/cache/application"
9
+
10
+ # Include helpers if not already included
11
+ helper MissionControl::Cache::ApplicationHelper unless self < MissionControl::Cache::ApplicationHelper
12
+ helper Importmap::ImportmapTagsHelper unless self < Importmap::ImportmapTagsHelper
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ module MissionControl
2
+ module Cache
3
+ class DashboardController < ApplicationController
4
+ def index
5
+ @total_entries = Rails.cache.instance_variable_get(:@data)&.size || 0
6
+ @hit_rate = "#{rand(70..99)}%" # Placeholder for actual hit rate calculation
7
+ @memory_usage = "#{rand(10..100)} MB" # Placeholder for actual memory usage
8
+
9
+ # Sample recent operations for display
10
+ @recent_operations = sample_operations
11
+ end
12
+
13
+ private
14
+
15
+ def sample_operations
16
+ # This is just sample data - in a real implementation, you would track actual cache operations
17
+ operations = []
18
+ 10.times do |i|
19
+ operations << {
20
+ key: "cache_key_#{i}",
21
+ operation: ["read", "write", "delete"].sample,
22
+ size: "#{rand(1..1000)} KB",
23
+ timestamp: Time.now - rand(1..60).minutes
24
+ }
25
+ end
26
+ operations
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,15 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ class ApplicationController < ActionController::Base
4
+ ActionController::Base::MODULES.each do |mod|
5
+ include mod unless self < mod
6
+ end
7
+
8
+ layout "solid_cache/dashboard/application"
9
+
10
+ # Include helpers if not already included
11
+ helper SolidCache::Dashboard::ApplicationHelper unless self < SolidCache::Dashboard::ApplicationHelper
12
+ helper Importmap::ImportmapTagsHelper unless self < Importmap::ImportmapTagsHelper
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,30 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ class DashboardController < ApplicationController
4
+ def index
5
+ @total_entries = Rails.cache.instance_variable_get(:@data)&.size || 0
6
+ @hit_rate = "#{rand(70..99)}%" # Placeholder for actual hit rate calculation
7
+ @memory_usage = "#{rand(10..100)} MB" # Placeholder for actual memory usage
8
+
9
+ # Sample recent operations for display
10
+ @recent_operations = sample_operations
11
+ end
12
+
13
+ private
14
+
15
+ def sample_operations
16
+ # This is just sample data - in a real implementation, you would track actual cache operations
17
+ operations = []
18
+ 10.times do |i|
19
+ operations << {
20
+ key: "cache_key_#{i}",
21
+ operation: ["read", "write", "delete"].sample,
22
+ size: "#{rand(1..1000)} KB",
23
+ timestamp: Time.now - rand(1..60).minutes
24
+ }
25
+ end
26
+ operations
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,6 @@
1
+ module MissionControl
2
+ module Cache
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,8 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ class ApplicationMailer < ActionMailer::Base
4
+ default from: "from@example.com"
5
+ layout "mailer"
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Mission Control: Cache</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= yield :head %>
9
+
10
+ <%= stylesheet_link_tag "mission_control/cache/application", media: "all" %>
11
+ </head>
12
+ <body>
13
+
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Solid cache dashboard</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= yield :head %>
9
+
10
+ <%= stylesheet_link_tag "solid_cache/dashboard/application", media: "all" %>
11
+ </head>
12
+ <body>
13
+
14
+ <%= yield %>
15
+
16
+ </body>
17
+ </html>
@@ -0,0 +1,53 @@
1
+ <div class="container mx-auto px-4 py-8">
2
+ <h1 class="text-2xl font-bold mb-6">Mission Control: Cache</h1>
3
+
4
+ <div class="bg-white shadow-md rounded-lg p-6 mb-6">
5
+ <h2 class="text-xl font-semibold mb-4">Cache Stats</h2>
6
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
7
+ <div class="bg-blue-50 p-4 rounded-lg">
8
+ <h3 class="text-sm font-medium text-blue-800">Total Entries</h3>
9
+ <p class="text-2xl font-bold"><%= @total_entries || 0 %></p>
10
+ </div>
11
+ <div class="bg-green-50 p-4 rounded-lg">
12
+ <h3 class="text-sm font-medium text-green-800">Hit Rate</h3>
13
+ <p class="text-2xl font-bold"><%= @hit_rate || "0%" %></p>
14
+ </div>
15
+ <div class="bg-purple-50 p-4 rounded-lg">
16
+ <h3 class="text-sm font-medium text-purple-800">Memory Usage</h3>
17
+ <p class="text-2xl font-bold"><%= @memory_usage || "0 MB" %></p>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="bg-white shadow-md rounded-lg p-6">
23
+ <h2 class="text-xl font-semibold mb-4">Recent Cache Operations</h2>
24
+ <div class="overflow-x-auto">
25
+ <table class="min-w-full divide-y divide-gray-200">
26
+ <thead>
27
+ <tr>
28
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Key</th>
29
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Operation</th>
30
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Size</th>
31
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Timestamp</th>
32
+ </tr>
33
+ </thead>
34
+ <tbody class="bg-white divide-y divide-gray-200">
35
+ <% if @recent_operations && @recent_operations.any? %>
36
+ <% @recent_operations.each do |operation| %>
37
+ <tr>
38
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><%= operation[:key] %></td>
39
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:operation] %></td>
40
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:size] %></td>
41
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:timestamp] %></td>
42
+ </tr>
43
+ <% end %>
44
+ <% else %>
45
+ <tr>
46
+ <td colspan="4" class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">No recent operations</td>
47
+ </tr>
48
+ <% end %>
49
+ </tbody>
50
+ </table>
51
+ </div>
52
+ </div>
53
+ </div>
@@ -0,0 +1,53 @@
1
+ <div class="container mx-auto px-4 py-8">
2
+ <h1 class="text-2xl font-bold mb-6">SolidCache Dashboard</h1>
3
+
4
+ <div class="bg-white shadow-md rounded-lg p-6 mb-6">
5
+ <h2 class="text-xl font-semibold mb-4">Cache Stats</h2>
6
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
7
+ <div class="bg-blue-50 p-4 rounded-lg">
8
+ <h3 class="text-sm font-medium text-blue-800">Total Entries</h3>
9
+ <p class="text-2xl font-bold"><%= @total_entries || 0 %></p>
10
+ </div>
11
+ <div class="bg-green-50 p-4 rounded-lg">
12
+ <h3 class="text-sm font-medium text-green-800">Hit Rate</h3>
13
+ <p class="text-2xl font-bold"><%= @hit_rate || "0%" %></p>
14
+ </div>
15
+ <div class="bg-purple-50 p-4 rounded-lg">
16
+ <h3 class="text-sm font-medium text-purple-800">Memory Usage</h3>
17
+ <p class="text-2xl font-bold"><%= @memory_usage || "0 MB" %></p>
18
+ </div>
19
+ </div>
20
+ </div>
21
+
22
+ <div class="bg-white shadow-md rounded-lg p-6">
23
+ <h2 class="text-xl font-semibold mb-4">Recent Cache Operations</h2>
24
+ <div class="overflow-x-auto">
25
+ <table class="min-w-full divide-y divide-gray-200">
26
+ <thead>
27
+ <tr>
28
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Key</th>
29
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Operation</th>
30
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Size</th>
31
+ <th class="px-6 py-3 bg-gray-50 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Timestamp</th>
32
+ </tr>
33
+ </thead>
34
+ <tbody class="bg-white divide-y divide-gray-200">
35
+ <% if @recent_operations && @recent_operations.any? %>
36
+ <% @recent_operations.each do |operation| %>
37
+ <tr>
38
+ <td class="px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"><%= operation[:key] %></td>
39
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:operation] %></td>
40
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:size] %></td>
41
+ <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500"><%= operation[:timestamp] %></td>
42
+ </tr>
43
+ <% end %>
44
+ <% else %>
45
+ <tr>
46
+ <td colspan="4" class="px-6 py-4 whitespace-nowrap text-sm text-gray-500 text-center">No recent operations</td>
47
+ </tr>
48
+ <% end %>
49
+ </tbody>
50
+ </table>
51
+ </div>
52
+ </div>
53
+ </div>
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ MissionControl::Cache::Engine.routes.draw do
2
+ root to: "dashboard#index"
3
+ end
@@ -0,0 +1,28 @@
1
+ require "importmap-rails"
2
+ require "turbo-rails"
3
+ require "stimulus-rails"
4
+
5
+ module MissionControl
6
+ module Cache
7
+ class Engine < ::Rails::Engine
8
+ isolate_namespace MissionControl::Cache
9
+
10
+ initializer "mission_control-cache.assets" do |app|
11
+ app.config.assets.paths << root.join("app/assets/stylesheets")
12
+ app.config.assets.paths << root.join("app/javascript")
13
+ app.config.assets.precompile += %w[ mission_control_cache_manifest ]
14
+ end
15
+
16
+ initializer "mission_control-cache.importmap", after: "importmap" do |app|
17
+ MissionControl::Cache.importmap.draw(root.join("config/importmap.rb"))
18
+ if app.config.importmap.sweep_cache && app.config.reloading_enabled?
19
+ MissionControl::Cache.importmap.cache_sweeper(watches: root.join("app/javascript"))
20
+
21
+ ActiveSupport.on_load(:action_controller_base) do
22
+ before_action { MissionControl::Cache.importmap.cache_sweeper.execute_if_updated }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module MissionControl
2
+ module Cache
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require "mission_control/cache/version"
2
+ require "mission_control/cache/engine"
3
+
4
+ module MissionControl
5
+ module Cache
6
+ mattr_accessor :base_controller_class, default: "::ApplicationController"
7
+ mattr_accessor :importmap, default: Importmap::Map.new
8
+ end
9
+ end
@@ -0,0 +1 @@
1
+ require "mission_control/cache"
@@ -0,0 +1,28 @@
1
+ require "importmap-rails"
2
+ require "turbo-rails"
3
+ require "stimulus-rails"
4
+
5
+ module SolidCache
6
+ module Dashboard
7
+ class Engine < ::Rails::Engine
8
+ isolate_namespace SolidCache::Dashboard
9
+
10
+ initializer "solid_cache-dashboard.assets" do |app|
11
+ app.config.assets.paths << root.join("app/assets/stylesheets")
12
+ app.config.assets.paths << root.join("app/javascript")
13
+ app.config.assets.precompile += %w[ solid_cache_dashboard_manifest ]
14
+ end
15
+
16
+ initializer "solid_cache-dashboard.importmap", after: "importmap" do |app|
17
+ SolidCache::Dashboard.importmap.draw(root.join("config/importmap.rb"))
18
+ if app.config.importmap.sweep_cache && app.config.reloading_enabled?
19
+ SolidCache::Dashboard.importmap.cache_sweeper(watches: root.join("app/javascript"))
20
+
21
+ ActiveSupport.on_load(:action_controller_base) do
22
+ before_action { SolidCache::Dashboard.importmap.cache_sweeper.execute_if_updated }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ module SolidCache
2
+ module Dashboard
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ require "solid_cache/dashboard/version"
2
+ require "solid_cache/dashboard/engine"
3
+
4
+ module SolidCache
5
+ module Dashboard
6
+ mattr_accessor :base_controller_class, default: "::ApplicationController"
7
+ mattr_accessor :importmap, default: Importmap::Map.new
8
+ end
9
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :solid_cache_dashboard do
3
+ # # Task goes here
4
+ # end
metadata ADDED
@@ -0,0 +1,411 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mission_control-cache
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - EngMarketer
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activerecord
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '7.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '7.1'
27
+ - !ruby/object:Gem::Dependency
28
+ name: actionpack
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '7.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '7.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: actioncable
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '7.1'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '7.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: railties
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '7.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '7.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: importmap-rails
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.2.1
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: 1.2.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: turbo-rails
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: stimulus-rails
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: irb
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '1.13'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '1.13'
125
+ - !ruby/object:Gem::Dependency
126
+ name: solid_cache
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: resque
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: solid_queue
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - "~>"
158
+ - !ruby/object:Gem::Version
159
+ version: 1.0.1
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - "~>"
165
+ - !ruby/object:Gem::Version
166
+ version: 1.0.1
167
+ - !ruby/object:Gem::Dependency
168
+ name: selenium-webdriver
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ - !ruby/object:Gem::Dependency
182
+ name: resque-pause
183
+ requirement: !ruby/object:Gem::Requirement
184
+ requirements:
185
+ - - ">="
186
+ - !ruby/object:Gem::Version
187
+ version: '0'
188
+ type: :development
189
+ prerelease: false
190
+ version_requirements: !ruby/object:Gem::Requirement
191
+ requirements:
192
+ - - ">="
193
+ - !ruby/object:Gem::Version
194
+ version: '0'
195
+ - !ruby/object:Gem::Dependency
196
+ name: mocha
197
+ requirement: !ruby/object:Gem::Requirement
198
+ requirements:
199
+ - - ">="
200
+ - !ruby/object:Gem::Version
201
+ version: '0'
202
+ type: :development
203
+ prerelease: false
204
+ version_requirements: !ruby/object:Gem::Requirement
205
+ requirements:
206
+ - - ">="
207
+ - !ruby/object:Gem::Version
208
+ version: '0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: debug
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ">="
214
+ - !ruby/object:Gem::Version
215
+ version: '0'
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ">="
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ - !ruby/object:Gem::Dependency
224
+ name: redis
225
+ requirement: !ruby/object:Gem::Requirement
226
+ requirements:
227
+ - - ">="
228
+ - !ruby/object:Gem::Version
229
+ version: '0'
230
+ type: :development
231
+ prerelease: false
232
+ version_requirements: !ruby/object:Gem::Requirement
233
+ requirements:
234
+ - - ">="
235
+ - !ruby/object:Gem::Version
236
+ version: '0'
237
+ - !ruby/object:Gem::Dependency
238
+ name: redis-namespace
239
+ requirement: !ruby/object:Gem::Requirement
240
+ requirements:
241
+ - - ">="
242
+ - !ruby/object:Gem::Version
243
+ version: '0'
244
+ type: :development
245
+ prerelease: false
246
+ version_requirements: !ruby/object:Gem::Requirement
247
+ requirements:
248
+ - - ">="
249
+ - !ruby/object:Gem::Version
250
+ version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: rubocop
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - "~>"
256
+ - !ruby/object:Gem::Version
257
+ version: 1.52.0
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - "~>"
263
+ - !ruby/object:Gem::Version
264
+ version: 1.52.0
265
+ - !ruby/object:Gem::Dependency
266
+ name: rubocop-performance
267
+ requirement: !ruby/object:Gem::Requirement
268
+ requirements:
269
+ - - ">="
270
+ - !ruby/object:Gem::Version
271
+ version: '0'
272
+ type: :development
273
+ prerelease: false
274
+ version_requirements: !ruby/object:Gem::Requirement
275
+ requirements:
276
+ - - ">="
277
+ - !ruby/object:Gem::Version
278
+ version: '0'
279
+ - !ruby/object:Gem::Dependency
280
+ name: rubocop-rails-omakase
281
+ requirement: !ruby/object:Gem::Requirement
282
+ requirements:
283
+ - - ">="
284
+ - !ruby/object:Gem::Version
285
+ version: '0'
286
+ type: :development
287
+ prerelease: false
288
+ version_requirements: !ruby/object:Gem::Requirement
289
+ requirements:
290
+ - - ">="
291
+ - !ruby/object:Gem::Version
292
+ version: '0'
293
+ - !ruby/object:Gem::Dependency
294
+ name: better_html
295
+ requirement: !ruby/object:Gem::Requirement
296
+ requirements:
297
+ - - ">="
298
+ - !ruby/object:Gem::Version
299
+ version: '0'
300
+ type: :development
301
+ prerelease: false
302
+ version_requirements: !ruby/object:Gem::Requirement
303
+ requirements:
304
+ - - ">="
305
+ - !ruby/object:Gem::Version
306
+ version: '0'
307
+ - !ruby/object:Gem::Dependency
308
+ name: propshaft
309
+ requirement: !ruby/object:Gem::Requirement
310
+ requirements:
311
+ - - ">="
312
+ - !ruby/object:Gem::Version
313
+ version: '0'
314
+ type: :development
315
+ prerelease: false
316
+ version_requirements: !ruby/object:Gem::Requirement
317
+ requirements:
318
+ - - ">="
319
+ - !ruby/object:Gem::Version
320
+ version: '0'
321
+ - !ruby/object:Gem::Dependency
322
+ name: sqlite3
323
+ requirement: !ruby/object:Gem::Requirement
324
+ requirements:
325
+ - - ">="
326
+ - !ruby/object:Gem::Version
327
+ version: '0'
328
+ type: :development
329
+ prerelease: false
330
+ version_requirements: !ruby/object:Gem::Requirement
331
+ requirements:
332
+ - - ">="
333
+ - !ruby/object:Gem::Version
334
+ version: '0'
335
+ - !ruby/object:Gem::Dependency
336
+ name: puma
337
+ requirement: !ruby/object:Gem::Requirement
338
+ requirements:
339
+ - - ">="
340
+ - !ruby/object:Gem::Version
341
+ version: '0'
342
+ type: :development
343
+ prerelease: false
344
+ version_requirements: !ruby/object:Gem::Requirement
345
+ requirements:
346
+ - - ">="
347
+ - !ruby/object:Gem::Version
348
+ version: '0'
349
+ description: Mission Control dashboard for monitoring and managing SolidCache
350
+ email:
351
+ - engmarketer@fastmail.com
352
+ executables: []
353
+ extensions: []
354
+ extra_rdoc_files: []
355
+ files:
356
+ - MIT-LICENSE
357
+ - README.md
358
+ - Rakefile
359
+ - app/assets/stylesheets/mission_control/cache/application.css
360
+ - app/assets/stylesheets/mission_control/cache/tailwind.css
361
+ - app/assets/stylesheets/solid_cache/dashboard/application.css
362
+ - app/assets/stylesheets/solid_cache/dashboard/tailwind.css
363
+ - app/controllers/mission_control/cache/application_controller.rb
364
+ - app/controllers/mission_control/cache/dashboard_controller.rb
365
+ - app/controllers/solid_cache/dashboard/application_controller.rb
366
+ - app/controllers/solid_cache/dashboard/dashboard_controller.rb
367
+ - app/helpers/mission_control/cache/application_helper.rb
368
+ - app/helpers/solid_cache/dashboard/application_helper.rb
369
+ - app/jobs/solid_cache/dashboard/application_job.rb
370
+ - app/mailers/solid_cache/dashboard/application_mailer.rb
371
+ - app/models/solid_cache/dashboard/application_record.rb
372
+ - app/views/layouts/mission_control/cache/application.html.erb
373
+ - app/views/layouts/solid_cache/dashboard/application.html.erb
374
+ - app/views/mission_control/cache/dashboard/index.html.erb
375
+ - app/views/solid_cache/dashboard/dashboard/index.html.erb
376
+ - config/routes.rb
377
+ - lib/mission_control-cache.rb
378
+ - lib/mission_control/cache.rb
379
+ - lib/mission_control/cache/engine.rb
380
+ - lib/mission_control/cache/version.rb
381
+ - lib/solid_cache/dashboard.rb
382
+ - lib/solid_cache/dashboard/engine.rb
383
+ - lib/solid_cache/dashboard/version.rb
384
+ - lib/tasks/solid_cache/dashboard_tasks.rake
385
+ homepage: https://github.com/engmarketer/mission_control-cache
386
+ licenses:
387
+ - MIT
388
+ metadata:
389
+ homepage_uri: https://github.com/engmarketer/mission_control-cache
390
+ source_code_uri: https://github.com/engmarketer/mission_control-cache
391
+ changelog_uri: https://github.com/engmarketer/mission_control-cache/blob/main/CHANGELOG.md
392
+ post_install_message:
393
+ rdoc_options: []
394
+ require_paths:
395
+ - lib
396
+ required_ruby_version: !ruby/object:Gem::Requirement
397
+ requirements:
398
+ - - ">="
399
+ - !ruby/object:Gem::Version
400
+ version: '0'
401
+ required_rubygems_version: !ruby/object:Gem::Requirement
402
+ requirements:
403
+ - - ">="
404
+ - !ruby/object:Gem::Version
405
+ version: '0'
406
+ requirements: []
407
+ rubygems_version: 3.4.10
408
+ signing_key:
409
+ specification_version: 4
410
+ summary: Mission Control for SolidCache
411
+ test_files: []