More DasBlog Hacking

Although my recent optimization changes improved DasBlog performance drastically, enough for me to defer switching from file-based storage to MySQL or Berkeley DB XML, I had to do something about RSS feeds being generated dynamically.

These feeds don't change unless content changes, so it makes more sense to generate them only when content changes.  Besides, I needed to preserve URLs to my feeds so I needed a way to detect change to content automatically and force regeneration of those feeds.

To do this, I used System.IO.FileSystemWatcher to watch DasBlog's content directory and fire ContentChanged events which RSS builders and secondary data structures like CategoryCache and EntryIdCache instances listen to and react accordingly.  Now I can make changes directly to files in the content folder and those changes are reflected in both the web pages and the feeds.  Nice.

Classes like FileSystemWatcher has to be used carefully because many events firing over a short span of time will force unnecessary updates.  For protection, I used delayed update as a cheap event folding mechanism.  This technique doesn't protect against recursions which happens when a ContentChanged event listener makes change to the content directory.