I\'ve done some googling and couldn\'t find the answer to this question. Rails allows to specify expiry times for its cache like that:
Rails.cache.fetch(\"my_var