Add database-based API key verification

I thought I'd share the code for adding DB-based API key verification. I'm using our cached database call function which stores the result for 10 minutes to speed up multiple API requests in sequence.