[Dbix-class] Caching total_entires in the Pager -- how can build a good cache key?

Peter Rabbitson rabbit+dbic at rabbit.us
Sat Aug 10 05:29:40 GMT 2013

On Fri, Aug 09, 2013 at 12:24:39PM -0700, Bill Moseley wrote:
> On Fri, Aug 9, 2013 at 10:44 AM, Peter Rabbitson <rabbit+dbic at rabbit.us>wrote:
> >
> > > (In my case I don't have $orig_unpaged_rs as I'm using a role to apply
> > > paging to all the actions that work on collections -- so I'd still have
> > to
> > > "strip" the $rs->{attrs} as in my original, which is a bit dirty.)
> >
> > Not only dirty but guaranteed to break in the future - {attrs} will
> > eventually disappear. If you can have the role preserve the "clean" rs -
> > do that, it will save you a lot of headache down the road.
> >
> Ok.  In my case I don't have $orig_unpaged_rs -- I'm passed an $rs.

Right... I understood you are passed an $rs and *you* add the paging to 
it. In which case saving the original isn't problematic.

> Could we have a method to replace the {attrs} hacking?

Once {attrs} is replaced with something saner - yes. Until then - not 
really. In any case - {attrs} will not be removed silently. There will 
be a long deprec cycle with callsite-highlighting using Variable::Magic 
or similar. So code will definitely not break overnight on upgrade, this 
is not how DBIC does things.

I was just pointing out that {attrs}-hacking is to be avoided unless the 
cost is prohibitive.


More information about the DBIx-Class mailing list