in reply to not caching to object in code interface to database?
First, I would encourage you to look at Rose::DB::Object, since this looks awfully familiar.
The caching you're describing is a pretty common practice. It does have risks, in that the data in memory is not guaranteed to reflect the database unless you grab an exclusive lock on it (e.g. SELECT...FOR UPDATE). There has been some writing on the subject in the past, since this has been the way things are done for decades. I think I once read something by Fowler about it.
The gist of it is that most programmers copy database state into memory for at least short periods of time in order to make it easier to deal with. Then they write it back out. Many millions of hours of effort have been put into making this process easier and/or hiding it from client code. You're on a similar track and you're not wrong to do it this way.
|
|---|