On 5/1/06, Guillermo Roditi <[EMAIL PROTECTED]> wrote:
Is there any reason why I wouldn't want to use Rose::DB::Object::Cached for everything instead of just using Rose::DB:: Object as a base for my database table classes?
I think the description section from the POD contains some very good reasons not to use Rose::DB::Object::Cached in the general case: http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Cached.pm#DESCRIPTION The short answer is this: Unless your data is (mostly) "read-only," you probably don't want to use Rose::DB::Object::Cached. Also remember that Rose::DB::Object::Cached only affects load() and save(). It has no effect on Rose::DB::Object::Manager queries at all. Here's a situation that *would* be ideal for Rose::DB::Object::Cached. Imagine a web app with a "categories" table in the database, where the list of categories "never" changes (e.g., maybe changes a few times a year, and a server restart is acceptable in order to refresh the web app(s)). Let's say the web app needs to print the name and other info from those categories frequently. In this case, it would be reasonable to base the Category class on Rose::DB::Object::Cached. Then you could be assured that your web app won't hit the database again and again only to get the same information back every time. You could even pre-load all the Category objects in startup.pl to prime the cache: $categories = Category::Manager->get_categories; foreach my $category (@$categories) { $category->remember; # save in cache } Then your web app will never hit the database at all when load()ing a Category object, and the cache will be shared across all apache children. -John ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object