[Dbix-class] relationships and caching

Michael Kang mkang at iparadigms.com
Mon Apr 17 23:47:20 CEST 2006


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



More information about the Dbix-class mailing list