I implemented moneta caching w/ memcache for get(key) and many-to-one relationships. I was unable to implement it for one-to-one, one-to- many, or many-to-many. Two important tips: You cannot do bulk SQL operations unless you specifically handle the bulk ops one by one in memcache or nuke the memcache. The correct functionality is in BOTH after(:save) and after(:delete) to delete the object from memcache.
The direct reason I could not is that DM uses procs to represent the relationships, and these procs cannot be serialized by Marshal. However, even if you could marshall these, it would be a very hard problem to maintain data integrity across a model's children if someone elsewhere were to update one of those children independently. When I have had to do caching like you describe for children, it's been ad hoc, and usually where I knew that the objs were read-only, at least for the time period I was caching them. I haven't shared any of the caching code I've done, as it's pretty simple, and lacks thorough stand-alone specs. Also, we've been having a low percent of disconnects with the memcache server (local) that we've been unable to explain. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.