Move social_image cache to Redis (#4818)

This commit is contained in:
jeffin sam 2019-11-16 00:33:41 +05:30 committed by Mac Siri
parent e92b005d02
commit da2fa608c2

View file

@ -32,9 +32,9 @@ module Articles
attr_reader :article
def legacy_article_social_image
cache_key = "article-social-img-#{article}-#{article.updated_at}-#{article.comments_count}"
cache_key = "article-social-img-#{article}-#{article.updated_at.rfc3339}-#{article.comments_count}"
Rails.cache.fetch(cache_key, expires_in: 1.hour) do
RedisRailsCache.fetch(cache_key, expires_in: 1.hour) do
src = GeneratedImage.new(article).social_image
return src if src.start_with? "https://res.cloudinary.com/"