API hit with memcache

The biggest fast-path we want to catch is empty hits to the friends timelines from API clients doing polling. Much of the time, you're going to check every few minutes and not get any updates... ideally this should be as fast as possible.

There are some OAuth memcache issues: we do several direct hits to databases while confirming OAuth authentication, which could become unpleasant if more clients move to OAuth in future if it's not fixed.

For password authentication, things seem smoother; it looks like we can actually go in there without any database hits. A quick test on my local test site for a hit from StatusNet Mobile, with CacheLog plugin on and database query logging on:

2010-10-28 22:36:38 LOG_INFO: [status.leuksman.com:9163.3a3a3f41 GET /api/statuses/friends_timeline.atom?since_id=52574]

CacheLogPlugin: Fetching key 'statusnet:brionitron:config:settings' CacheLogPlugin: Cache HIT for key "statusnet:brionitron:config:settings": array of length 35

STATLOG action:apitimelinefriends method:GET ssl:yes query:since_id cookie:no auth:yes ifmatch:no ifmod:no agent:no

CacheLogPlugin: Fetching key 'statusnet:brionitron:user:nickname:briontest' CacheLogPlugin: Cache HIT for key "statusnet:brionitron:user:nickname:briontest": object of class User

CacheLogPlugin: Fetching key 'statusnet:brionitron:inbox:user_id:1' CacheLogPlugin: Cache HIT for key "statusnet:brionitron:inbox:user_id:1": object of class Inbox

CacheLogPlugin: Fetching key 'statusnet:brionitron:profile:id:1' CacheLogPlugin: Cache HIT for key "statusnet:brionitron:profile:id:1": object of class Profile

CacheLogPlugin: Fetching key 'statusnet:brionitron:avatar:height,profile_id,width:96,1,96' CacheLogPlugin: Cache HIT for key "statusnet:brionitron:avatar:height,profile_id,width:96,1,96": object of class Avatar

This could perhaps be cut down a little further by consolidating the actual output so we don't have to fetch the profile and avatar separately; and maybe even to skip the inbox, but we're not hitting any database servers which is nice to see.

Still should test the CPU usage and runtime.