Ah yes. I am connecting to multiple databases and thus relying on
Datamapper.repository(:repo_name) { ... } to specify which one. Is
there another way to do this that doesn't hit the IdentityMap?

-psanford

On Tue, Jul 26, 2011 at 4:27 PM, Emmanuel Gomez
<[email protected]> wrote:
> On Jul 26, 2011, at 4:17 PM, psanford wrote:
>> Is it possible to globally disable caching?
>
> Do you have reason to believe that results of a Model#all call are being 
> cached? ie., do you have a case where multiple calls to Model#all do not 
> produce multiple queries to the DB? Watch the log to be sure, because in my 
> experience, Model#all hits the db unless the IdentityMap is involved.
>
>> My problem is I have a number daemons that fetch out objects from a
>> database and then do some work on them. Multiple daemons might be
>> working on the same tables so when I call .all on a model I really
>> want to fetch the records again. I know that I can call reload on
>> objects or pass :reload to .all, but I would like to do this globally
>> somewhere. Is this possible?
>
> I'm pretty sure that the only thing that would *enable* global caching of 
> this sort is the IdentityMap. If you don't have IdentityMap enabled 
> explicitly, it will not be used. If this is all taking place in a Rails app, 
> for example, you would want to look for:
>
>    require 'dm-rails/middleware/identity_map'
>    config.middleware.use "Rails::DataMapper::Middleware::IdentityMap"
>
> Or the like. If this is not in a Rails app, you would want to track down 
> `DataMapper.repository { … entry point to your code here … }`.
>
> Hope that helps,
> Emmanuel
>
> --
> You received this message because you are subscribed to the Google Groups 
> "DataMapper" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/datamapper?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to