Take 2 of switching to psql cache!

This commit is contained in:
Max Wofford
2025-06-27 21:26:29 -04:00
parent fd55df1742
commit 8eb6072612
3 changed files with 30 additions and 4 deletions

View File

@@ -104,9 +104,9 @@ production:
replica: true
cache:
<<: *default
adapter: sqlite3
database: storage/production_cache.sqlite3
migrations_paths: db/cache_migrate
adapter: postgresql
encoding: unicode
url: <%= ENV['DATABASE_URL'] %>
cable:
<<: *default
adapter: sqlite3

View File

@@ -0,0 +1,15 @@
class CreateSolidCacheEntries < ActiveRecord::Migration[8.0]
def change
create_table :solid_cache_entries do |t|
t.binary :key, limit: 1024, null: false
t.binary :value, limit: 536870912, null: false
t.datetime :created_at, null: false
t.integer :key_hash, limit: 8, null: false
t.integer :byte_size, limit: 4, null: false
t.index :byte_size
t.index [ :key_hash, :byte_size ]
t.index :key_hash, unique: true
end
end
end

13
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_06_26_001500) do
ActiveRecord::Schema[8.0].define(version: 2025_06_28_011017) do
create_schema "pganalyze"
# These are extensions that must be enabled in order to support this database
@@ -472,6 +472,17 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_26_001500) do
t.index ["user_id"], name: "index_sign_in_tokens_on_user_id"
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.bigint "key_hash", null: false
t.integer "byte_size", null: false
t.index ["byte_size"], name: "index_solid_cache_entries_on_byte_size"
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end
create_table "users", force: :cascade do |t|
t.string "slack_uid"
t.datetime "created_at", null: false