Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: object identity in DBIx::Class

by perrin (Chancellor)
on Apr 24, 2009 at 15:17 UTC ( [id://759866]=note: print w/replies, xml ) Need Help??


in reply to Re: object identity in DBIx::Class
in thread object identity in DBIx::Class

Caching is not what the OP asked for. It's more like the object uniqueness feature that Class::DBI had. No idea if DBIx::Class supports something similar.

Replies are listed 'Best First'.
Re^3: object identity in DBIx::Class
by spx2 (Deacon) on Apr 24, 2009 at 15:27 UTC

    he wants the exact same results to be returned on a second call to ->find. what he didn't envision is a scenario where you have multiple processes writing in the db and ->find with the same arguments could return a totally different thing,so what he wants isn't very "thread-safe"(although ironically Perl has no usable threads from what I was told on multiple occasions).

    if he has just one process writing on the db then you're right,he could just switch to Class::DBI,and read this.

      and ->find with the same arguments could return a totally different thing
      Please note that I am not talking about arbitrary finds but finds for a primary key (maybe I made myself not clear).

      What I want is (within one process) one db-entity (where indentity is given by primary key) to be represented at the object-level by the one and only one instance.

      It would lead too far to explain why this is important to me.

      Different processes would be in different transactions, that's no problem at all.

      ironically Perl has no usable threads
      Not true (and without any relevance for the question at hand).
      switch to Class::DBI,and read this.
      I have been thinking about building a cache using weak references myself, thanks for the link.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://759866]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-03-19 06:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found