[Dbix-class] Creating custom ResultSet Class.

Jess Robinson castaway at desert-island.me.uk
Thu Apr 26 22:05:07 GMT 2007




On Thu, 26 Apr 2007, Oleg Pronin wrote:

> Hello!
>
> I want to create custom resultset class that will allow caching (in
> memcached) functionality.
>
> For example,
> @users = $rs->search(undef, {order_by => 'rating', rows => 10, memcache =>
> 60});
>
> This will give stored in memcached and automatically updated every 60
> seconds top10 users list.
>
> To do that i need every resultsource to use my resultset class.
> Cookbook says i've got to
> $source->resultset_class('My::ResultSet::Class');
> But i dont want to write it in every result source!
>
> Is there a good way to set my custom resultset to all registered result
> sources?
>

Yes, its a perl feature called a "base class" ;)

Jess




More information about the Dbix-class mailing list