Class: ActiveRecord::ConnectionAdapters::PostgreSQLAdapter

Inherits:
AbstractAdapter
  • Object
show all
Defined in:
lib/query_memcached.rb

Instance Attribute Summary

Attributes inherited from AbstractAdapter

#memcache_query_cache_options

Instance Method Summary collapse

Instance Method Details

#execute_with_clean_query_cache(*args) ⇒ Object



93
94
95
96
97
98
99
100
101
# File 'lib/query_memcached.rb', line 93

def execute_with_clean_query_cache(*args)
  return execute_without_clean_query_cache(*args) unless self.memcache_query_cache_options && query_cache_enabled
  sql = args[0].strip
  if sql =~ /^(INSERT|UPDATE|ALTER|DROP|DELETE)/i
    table_name = ActiveRecord::Base.extract_table_names(sql).first
    ActiveRecord::Base.increase_version!(table_name)
  end
  execute_without_clean_query_cache(*args)
end