Quantcast
Channel: Active questions tagged memcached+heroku - Stack Overflow
Viewing all articles
Browse latest Browse all 38

Memcached Returns Null When Table Is Updated - Rails

$
0
0

We're using Memcached with Rails on Heroku and it works fine. But when a row in a table gets updated, its respective cache method returns null when it's being created again after expiring.For example, the method returns name and logo from table seller then we update table seller and change the name in one of the rows. It keeps returning name and logo normally until it expires and then starts returning null. After that it keeps returning null until it expires or we flush cache. After that it returns to normal behavior.

Here's the method

def self.all_active_sellers Rails.cache.fetch('all_active_sellers/', expires_in: 5.minutes) do  Seller.where(status: 'active', is_validated: true)        .includes(:products).where.not(products: nil)        .where(products: { status: 'available' })        .where.not(products: { quantity: 0 }).with_attached_logo.with_attached_cover        .order(featured: :desc).uniq.to_a endend

Viewing all articles
Browse latest Browse all 38

Latest Images

Trending Articles





Latest Images