Forum: Ruby on Rails caching database result

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
62d907304b4f99b7b20b7d80cdf514df?d=identicon&s=25 Vogon Primo (vogon)
on 2011-02-21 15:11
Hi guys,
Has ActiveRecord 3 a more complex cache mechanism than version released
with Ruby on Rails 2.0 ?

And has ActiveRecord the concept of "scope of object identity?"

 obj1 = MyModel.find(1)
 obj2 = MyModel.find(1)

 results in two selects and two different object in memory, why?

Where I could find clear and detailed info about these topics?
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2011-02-21 15:52
(Received via mailing list)
On Feb 21, 2:11pm, Vogon Primo <li...@ruby-forum.com> wrote:
>
Because it's not trying to do anything different (the select itself
will be cached). The subject comes up every now and again, but
activerecord does not yet have an identity map

Fred
96146b7a23174e2e024c06a49f845bb8?d=identicon&s=25 Jeffrey L. Taylor (Guest)
on 2011-02-21 16:24
(Received via mailing list)
Quoting Vogon Primo <lists@ruby-forum.com>:
>
> Where I could find clear and detailed info about these topics?
>

The objects are the results of selects.  Some other program may have
changed
the value in between.  So the values may be different.  Rails does know
what
other programs are accessing the database.  Only the database server
knows.
And it can cache the result.  So two calls to the DB, possibly two
different
results.

Jeffrey
This topic is locked and can not be replied to.