Tuesday, March 01, 2011 at 1:07 AM.


on limitFeedHistory () {
		<<2/27/11; 6:00:56 PM by DW
			<<Until now there was no code to cut back the size of feed history tables. Two of my feeds had humongous tables of over 25K elements each. 
	local (adrdata = river2suite.init (), maxhist = adrdata^.prefs.maxFeedHistoryElements);
	for adrfeed in @adrdata^.feeds {
		if sizeof (adrfeed^.history) > maxhist {
			local (oldtarget = target.set (@adrfeed^.history));
			table.sortby ("Value");
			while sizeof (adrfeed^.history) > maxhist {
				delete (@adrfeed^.history [1])}; //delete the oldest
			target.set (oldtarget)}}};
bundle { //test code
	limitFeedHistory ()}

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.