Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load with zeitwerk #75

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions lib/active_support/cache/solid_cache_store.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "solid_cache"

module ActiveSupport
module Cache
SolidCacheStore = SolidCache::Store
Expand Down
10 changes: 7 additions & 3 deletions lib/solid_cache.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
require "solid_cache/version"
require "solid_cache/engine"
require "solid_cache/store"
require "zeitwerk"

loader = Zeitwerk::Loader.for_gem
loader.ignore("#{__dir__}/active_support")
loader.ignore("#{__dir__}/generators")
loader.setup
loader.eager_load

module SolidCache
mattr_accessor :executor, :connects_to
Expand Down
8 changes: 0 additions & 8 deletions lib/solid_cache/cluster.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@

module SolidCache
class Cluster
require "solid_cache/maglev_hash"
require "solid_cache/shards"
require "solid_cache/cluster/instrumented"
require "solid_cache/cluster/execution"
require "solid_cache/cluster/trimming"
require "solid_cache/cluster/sharded"
require "solid_cache/cluster/stats"

include Instrumented, Sharded, Execution, Trimming, Stats

def initialize(options = {})
Expand Down
1 change: 0 additions & 1 deletion lib/solid_cache/engine.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
require "active_support"
require "solid_cache"

module SolidCache
class Engine < ::Rails::Engine
Expand Down
2 changes: 0 additions & 2 deletions lib/solid_cache/shards.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
require "solid_cache/maglev_hash"

module SolidCache
class Shards
attr_reader :names, :nodes, :consistent_hash
Expand Down
6 changes: 0 additions & 6 deletions lib/solid_cache/store.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
require "solid_cache/cluster"

module SolidCache
class Store < ActiveSupport::Cache::Store
require "solid_cache/store/clusters"
require "solid_cache/store/operations"
require "solid_cache/store/api"

DEFAULT_ERROR_HANDLER = -> (method:, returning:, exception:) do
if logger
logger.error { "SolidCacheStore: #{method} failed, returned #{returning.inspect}: #{exception.class}: #{exception.message}" }
Expand Down