-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stanislav Katkov
committed
Oct 9, 2023
1 parent
f88c0f6
commit b055fb0
Showing
7 changed files
with
55 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
lib/generators/solid_cache/install/templates/create_solid_cache_entries_btree.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
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 | ||
|
12 changes: 12 additions & 0 deletions
12
lib/generators/solid_cache/install/templates/create_solid_cache_entries_hash.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
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, using: :hash | ||
end | ||
end | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
desc "Copy over the migration, and set cache" | ||
namespace :solid_cache do | ||
task :install do | ||
Rails::Command.invoke :generate, [ "solid_cache:install" ] | ||
task :install, [:index] do |_t, args| | ||
args.with_defaults(index: 'btree') | ||
|
||
if args[:index] == 'btree' || args[:index] == 'hash' | ||
Rails::Command.invoke :generate, [ "solid_cache:install", "--index=#{args[:index]}" ] | ||
else | ||
abort "Invalid index type - only 'btree' and 'hash' are supported." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters