[Dbix-class] relationships and caching

Jess Robinson castaway at desert-island.demon.co.uk
Tue Apr 18 10:10:26 CEST 2006


We already have search cacheing, which may be what you need.. For find I 
started one, but it turned out to be hairier than I imagined (and I 
managed to solve my problem another way)

So try a cache => 1 in the attribs?

Jess


  On Mon, 17 Apr 2006, Michael Kang wrote:

> Hi -
>
> A question about caching and esp. for relationships:
>
> Let's say I have a data model with a one-to-many relationship between
> Folders and Items:
>
> Folder->has_many ( items )
> Item->has_a ( folder )
>
> I've tried implementing a simple caching layer by overloading the
> create/find/update/delete methods, but this only works for simple row
> retrievals, since the column data is stored in the object. But for
> relationships, the SQL is generated and executed on the fly... anyone
> have an idea of a good way to make it work in this case?
>
> For example, when adding an item to a folder, I'd insert the row, but
> I'd also want the folder object in the cache to "know" about the new
> item, without having to hit the database again.
>
> I'd appreciate any input -
>
> Michael
>
> _______________________________________________
> 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/
>
>



More information about the Dbix-class mailing list