Tuesday, February 07, 2006

Trendy AllegroCache

CafeSpot's sister application trendalicious collects URLs posted to del.icio.us and ranks them according to the change in the number of people who have recently bookmarked the same URL. Originally trendalicious used a RAM-resident hashtable to track the URLs it had seen. This was fast, and much easier than using a SQL database, but fairly inaccurate because the volume of postings to del.icio.us meant that many URLs were missed between polls and then discarded as old because they hadn't been seen again.

Today trendalicious stores 24 hours of history (currently around 20,000 URLs and their associated popularity statistics) as persistent objects using Franz' AllegroCache. Accuracy is much improved because a URL's popularity can now be calculated as long as the URL is seen at least twice within 24 hours. Using AllegroCache is incredibly easy; any CLOS object can be made persistent by simply setting its metaclass to 'persistent-class' and specifying which slots are indexed. New and modified instances will be automatically stored when COMMIT is called. RETRIEVE-FROM-INDEX finds existing objects by indexed slot, and DELETE-INSTANCE removes an object from the db. Those three functions are the extent of trendalicious' use of AllegroCache but there is plenty more cool stuff including transactions, Prolog queries, and client/server mode.

2 Comments:

Blogger jason said...

Useful info here.. Do you use cl-ajax or parenscript for your javascript code, or just write the javascript code manually?

10:59 AM  
Blogger CafeSpot said...

Hi Jason, I wrote the Javascript by hand but parenscript looks very neat, will have to give it a try. Thanks!

11:48 PM  

<< Home