Set up Solid Cache

This commit is contained in:
Trevor Vallender 2023-10-19 20:28:18 +01:00
parent b7bbd85c7e
commit 059d59e437
5 changed files with 25 additions and 2 deletions

View File

@ -15,6 +15,7 @@ gem "bcrypt", "~> 3.1.7"
gem "bootsnap", require: false gem "bootsnap", require: false
gem "kaminari" # Pagination gem "kaminari" # Pagination
gem "solid_cache"
group :development, :test do group :development, :test do
gem "debug", platforms: %i[ mri mingw x64_mingw ] gem "debug", platforms: %i[ mri mingw x64_mingw ]

View File

@ -229,6 +229,8 @@ GEM
rexml (~> 3.2, >= 3.2.5) rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0) rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0) websocket (~> 1.0)
solid_cache (0.1.0)
rails (>= 7)
sprockets (4.2.1) sprockets (4.2.1)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4) rack (>= 2.2.4, < 4)
@ -281,6 +283,7 @@ DEPENDENCIES
puma puma
rails (~> 7.1) rails (~> 7.1)
selenium-webdriver selenium-webdriver
solid_cache
sprockets-rails sprockets-rails
stimulus-rails stimulus-rails
turbo-rails turbo-rails

View File

@ -56,7 +56,7 @@ Rails.application.configure do
config.log_tags = [ :request_id ] config.log_tags = [ :request_id ]
# Use a different cache store in production. # Use a different cache store in production.
# config.cache_store = :mem_cache_store config.cache_store = :solid_cache_store
# Use a real queuing backend for Active Job (and separate queues per environment). # Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque # config.active_job.queue_adapter = :resque

View File

@ -0,0 +1,12 @@
# This migration comes from solid_cache (originally 20230724121448)
class CreateSolidCacheEntries < ActiveRecord::Migration[7.0]
def change
create_table :solid_cache_entries do |t|
t.binary :key, null: false, limit: 1024
t.binary :value, null: false, limit: 512.megabytes
t.datetime :created_at, null: false
t.index :key, unique: true
end
end
end

9
db/schema.rb generated
View File

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[7.1].define(version: 2023_10_19_172703) do ActiveRecord::Schema[7.1].define(version: 2023_10_19_192600) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -77,6 +77,13 @@ ActiveRecord::Schema[7.1].define(version: 2023_10_19_172703) do
t.index ["tag_id", "micropost_id"], name: "index_microposts_tags_on_tag_id_and_micropost_id" t.index ["tag_id", "micropost_id"], name: "index_microposts_tags_on_tag_id_and_micropost_id"
end end
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", null: false
t.binary "value", null: false
t.datetime "created_at", null: false
t.index ["key"], name: "index_solid_cache_entries_on_key", unique: true
end
create_table "tags", force: :cascade do |t| create_table "tags", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false