Module: Sequel::Plugins::Cacheable::DatasetMethods
- Defined in:
- lib/sequel-cacheable.rb
Instance Method Summary collapse
Instance Method Details
#all(*args) ⇒ Object
203 204 205 206 207 208 209 |
# File 'lib/sequel-cacheable.rb', line 203 def all(*args) if model..query_cache? && @row_proc.kind_of?(Class) && @row_proc.included_modules.include?(Sequel::Model::InstanceMethods) @row_proc.cache_set_get(query_to_cache_key) { super(*args) } else super(*args) end end |
#first(*args) ⇒ Object
211 212 213 214 215 216 217 |
# File 'lib/sequel-cacheable.rb', line 211 def first(*args) if model..query_cache? && @row_proc.kind_of?(Class) && @row_proc.included_modules.include?(Sequel::Model::InstanceMethods) @row_proc.cache_set_get(query_to_cache_key) { super(*args) } else super(*args) end end |
#query_to_cache_key ⇒ Object
219 220 221 |
# File 'lib/sequel-cacheable.rb', line 219 def query_to_cache_key model.name + '::Query::' + select_sql.gsub(/ /, '_') end |