Hi There,
I suppose now is as good a time as any - The
Catalyst::Authentication::Store::DBIx::Class module currently on CPAN
has the 'avoid the db hit' code is in it. It is not enabled by
default, but add 'use_userdata_from_session => 1' to your config and
it will not reload from the database unless you specifically request
it. See the docs:
http://xrl.us/bgbn9
(aka
http://search.cpan.org/~jayk/Catalyst-Authentication-Store-DBIx-Class-0.104/lib/Catalyst/Authentication/Store/DBIx/Class.pm#CONFIGURATION
)
as there are some things you should know about operating in that mode.
Jay
On Feb 16, 2008, at 8:20 AM, Moritz Onken wrote:
If someone tells me where to put that kind of code Matt suggested
I'll write a patch and some (1? :-) ) tests.
Am 15.02.2008 um 02:16 schrieb Guillermo Roditi:
Which means the entire thing would be pointless. What you want to do
really is
$class->new({ %saved_stuff, -result_source => $schema-
>source($class) });
$new_obj->in_storage(1);
then it'll work "as if" you re-fetched the object (%saved_stuff
being the
return of $obj->get_columns). Making stuff work with only the PK
stashed
in the session is left as an exercise to the reader, but would
probably
be best done using Data::Thunk and Data::Swap.
/me confoos. Why not just use the shiny new freeze / thaw hooks?
Wouldn't it make sense to store a frozen version of the User row /
object in the session and then thaw it upon request? This seems like
it would be a really natural way to cache this information. Ideally,
the thawing would be a lazy operation as well i think.
I just bring this up because the code you just sent would not work
when one is using things like DigestColumns or EncodedColumn, which
are most commonly seen in User-type objects
--Guillermo Roditi (groditi)
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
---
"May we not return to those scoundrels of old, the illustrious
founders of superstition and fanaticism, who first took the knife from
the altar to make victims of those who refused to be their disciples."
- Voltaire
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/