conditional inserts and db.resolve inside cache handlers