1.9dev db-pre-rewrite
1.9 full commit. Fixed huge database caching problem and added better cache management.