I have a user - roles setup similar to 
Catalyst::Manual::Tutorial::Authentication.

My application quite often queries roles for the authenticated user
($c->user->obj) within one HTTP query.

For this purpose I defined a method in the DBIC user class like this:

sub has_role {
    my ($self, $name) = @_;
    $self->roles->find($role);
}

To save db access I'd prefer caching $user->roles->all inside the user 
object ($c->user->obj) in the first call of has_role() and access roles 
in subsequent calls to has_role() from this cache.

Is this possible?
-- 
Bernhard Graf

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to