Class: ActiveSupport::Cache::DatabaseStore::Model

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/active_support/cache/database_store/model.rb

Class Method Summary collapse

Class Method Details

.namespaced(namespace) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/active_support/cache/database_store/model.rb', line 17

def self.namespaced(namespace)
  case ActiveRecord::Base.connection.adapter_name
  when 'PostgreSQL'
    ifx = Arel::Nodes::InfixOperation.new('IN', Arel::Nodes.build_quoted(namespace), arel_table[:key])
    where(Arel::Nodes::NamedFunction.new('POSITION', [ifx]).eq(1))
  else
    where(arel_table[:key].matches("#{namespace}:%"))
  end
end

.truncate!Object



9
10
11
# File 'lib/active_support/cache/database_store/model.rb', line 9

def self.truncate!
  connection.truncate(table_name)
end