Commit Graph

5 Commits

Author SHA1 Message Date
Evan Prodromou
423227d2db make NoticeWrapper extend Notice so methods work
darcs-hash:20080915073006-84dde-8ea7daa73743647711a8c1d7389894b25f2b077d.gz
2008-09-15 03:30:06 -04:00
Evan Prodromou
6451b7ad6a another attribute error
darcs-hash:20080915072738-84dde-377131613c91dcb353bc6aaf55bae8ce1b7f13e5.gz
2008-09-15 03:27:38 -04:00
Evan Prodromou
4bd2c2ad72 misused instance attribute in noticewrapper
darcs-hash:20080915072553-84dde-6de01a486dfcf3440643584d1f698fe1b188f351.gz
2008-09-15 03:25:53 -04:00
Evan Prodromou
df724990bd array_count -> count
darcs-hash:20080915070951-84dde-be26f8844c884b0210cfd6165fd3403ce760195e.gz
2008-09-15 03:09:51 -04:00
Evan Prodromou
f246b8f2d7 cache noticesWithFriends in memcached
noticesWithFriends is turning out to be one of our most expensive
queries. The join is costly, and this method is hit over and over and
over by desktop clients and other API users.

So, I've added a first pass at caching the results. I store a "window"
of notices -- equal to the first 3 pages of notices, plus one for
pagination -- in the memcached cache. If with-friends notices are
requests, I fetch the whole window out of the cache and grab the slice
requested. If the requested notices are outside the window, we just do
the query. If there's nothing in the cache, we request the window and
store it, then return a slice.

I had to add a NoticeWrapper class that works like DB_DataObject
(well, just the fetch() part...) but just holds an array of notices
instead of a DB cursor.

Finally, saving a new notice blows away the caches for subscribed users.

darcs-hash:20080915065616-84dde-1b1e814c2294498a10b763b779cbb62c3f96aa84.gz
2008-09-15 02:56:16 -04:00