Skip to content

Commit

Permalink
Tidy up store includes
Browse files Browse the repository at this point in the history
  • Loading branch information
djmb committed Sep 26, 2023
1 parent 2a06413 commit c9c3231
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
8 changes: 1 addition & 7 deletions lib/solid_cache/store.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
module SolidCache
class Store < ActiveSupport::Cache::Store
DEFAULT_ERROR_HANDLER = -> (method:, returning:, exception:) do
if logger
logger.error { "SolidCacheStore: #{method} failed, returned #{returning.inspect}: #{exception.class}: #{exception.message}" }
end
end

include Api, Entries, Failsafe, Clusters
include Api, Clusters, Entries, Failsafe
prepend ActiveSupport::Cache::Strategy::LocalCache

def self.supports_cache_versioning?
Expand Down
1 change: 0 additions & 1 deletion lib/solid_cache/store/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def initialize(options = {})
super(options)

@max_key_bytesize = options.fetch(:max_key_bytesize, DEFAULT_MAX_KEY_BYTESIZE)
@error_handler = options.fetch(:error_handler, DEFAULT_ERROR_HANDLER)
end

def delete_matched(matcher, options = {})
Expand Down
6 changes: 6 additions & 0 deletions lib/solid_cache/store/failsafe.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
module SolidCache
class Store
module Failsafe
DEFAULT_ERROR_HANDLER = -> (method:, returning:, exception:) do
if Store.logger
Store.logger.error { "SolidCacheStore: #{method} failed, returned #{returning.inspect}: #{exception.class}: #{exception.message}" }
end
end

def initialize(options = {})
super(options)

Expand Down

0 comments on commit c9c3231

Please sign in to comment.