orslumen/record-cache — Issue #2: bypassing record_cache when selecting rows with lock
Author: dhruvg
Created: 2011-11-01 16:05:49+00:00
State: open

Hi,
Thanks for sharing record-cache, it is pretty solid.

I am tinkering around with it and I notice that record cache seems to hit the cache even when I want to retrieve rows with a lock. Example:

transaction do
Item.lock("lock in share mode").where(:conditions).each do |i|
...
end
end

When I look at my SQL logs, I only see:
BEGIN
COMMIT

The actual select query is not there. When I disable record_cache and do the same thing again, the select query is there as expected. So it makes me believe that record cache is retrieving from cache even though I want to lock the rows in the db.

What would be the best way to get around this, so for any lock selects, record-cache is bypassed?

Thanks!