Module: Sequel::Plugins::Cacheable
- Defined in:
- lib/sequel-cacheable.rb
Defined Under Namespace
Modules: ClassMethods, DatasetMethods, InstanceMethods
Class Method Summary collapse
Class Method Details
.configure(model, store, options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sequel-cacheable.rb', line 7 def self.configure(model, store, = {}) model.instance_eval do @cache_store = store @cache_store_type = Hashr.new({ :set_with_ttl => store.respond_to?(:set) ? store.method(:set).arity != 2 : false, :delete_method => ( (store.respond_to?(:del) && :del) || (store.respond_to?(:delete) && :delete) || (raise NoMethodError, "#{store.class} is not implemented delete method") ) }) @cache_options = Hashr.new(, { :ttl => 3600, :ignore_exception => false, :pack_lib => MessagePack, :query_cache => store.respond_to?(:keys) }) end end |