This project is archived and is in readonly mode.

#5731 ✓wontfix
joerodriguez (at gmail)

AR::Relation#cache_key

Reported by joerodriguez (at gmail) | September 29th, 2010 @ 01:28 PM

Provides a unique cache_key for ActiveRecord::Relation. Particularly useful when caching result sets or views:

@results = Person.babies

cache @results.cache_key do
  ...expensive stuff...
end

Comments and changes to this ticket

  • Robert Pankowecki
  • laserlemon

    laserlemon September 29th, 2010 @ 05:16 PM

    It seems like custom cache keys and custom expiration are better suited for these types of situations. A relation's cache key doesn't communicate anything about its expiration. So if another baby were added to the people table, the cache key would remain. I'd just as soon do:

    @results = Person.babies
    
    cache 'people/babies' do
      # Expensive stuff
    end
    

    if I have to expire the cache myself anyway.

  • David Trasbo

    David Trasbo October 9th, 2010 @ 08:17 PM

    • State changed from “new” to “wontfix”
    • Importance changed from “” to “Low”

    I agree with, erm, laserlemon. Marking this wont fix for now (even though it's not really my decision). Will reopen if this develops further.

  • af001

    af001 May 5th, 2011 @ 03:00 AM

    私の中で、総合評価のとっても低いアバアバクロホリスタークロ銀座店。アバクロは大好きなんですけどね。一昨日の東京駅付近での打ち合わせの後、散歩がてら久々に行ってきました。そしたらビックリ!相変わらアバクロず、踊っているだけの店員さんとかもいましたが、

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages