lib/kasket.rb in kasket-4.8.0 vs lib/kasket.rb in kasket-4.9.0
- old
+ new
@@ -15,12 +15,12 @@
autoload :SelectManagerMixin, 'kasket/select_manager_mixin'
autoload :RelationMixin, 'kasket/relation_mixin'
CONFIGURATION = { # rubocop:disable Style/MutableConstant
max_collection_size: 100,
- write_through: false,
- default_expires_in: nil
+ write_through: false,
+ default_expires_in: nil
}
module_function
def setup(options = {})
@@ -31,20 +31,25 @@
CONFIGURATION[:default_expires_in] = options[:default_expires_in] if options[:default_expires_in]
ActiveRecord::Base.extend(Kasket::ConfigurationMixin)
if defined?(ActiveRecord::Relation)
- ActiveRecord::Relation.send(:include, Kasket::RelationMixin)
- Arel::SelectManager.send(:include, Kasket::SelectManagerMixin)
+ ActiveRecord::Relation.include Kasket::RelationMixin
+ Arel::SelectManager.include Kasket::SelectManagerMixin
end
end
def self.cache_store=(options)
@cache_store = ActiveSupport::Cache.lookup_store(options)
end
- def self.cache
+ def self.cache_store
@cache_store ||= Rails.cache
+ end
+
+ # Alias cache_store to cache
+ class << self
+ alias_method :cache, :cache_store
end
# Keys are the records being saved.
# Values are either the saved record, or nil if the record has been destroyed.
def self.pending_records