title: Castle Project - Options for refreshing a Castle Windsor singleton (expire? notify?)
body: <p>I'm using Castle Windsor 2.0 for Dependency Injection in my ASP.NET MVC 2 project.</p>
  
  <p>One of my components holds application configuration data and is currently configured as a singleton (the intent is to avoid frequent trips to the database for values that don't change very often).</p>
  
  <pre><code>&lt;component id="Configuration" service="MyInterface, 
      MyAssembly" type="MyClass, MyAssembly2" lifestyle="Singleton" /&gt;
  </code></pre>
  
  <p>I just created an administrative site to make changes to the configuration.  The original application holds onto the configuration values until the application pool restarts (not a huge surprise).  The users will want the ability to apply their changes in a timely manner.</p>
  
  <p><strong>Possible Solutions:</strong></p>
  
  <ol>
  <li>Decrease lifetime of the application pool</li>
  <li>Have the site admins recycle the app pool if they want an immediate change</li>
  <li>Switch to another DI container</li>
  <li>Use a single website for everything</li>
  <li>Change the singleton to a PerWebRequest</li>
  <li>Create a mechanism that allows the admin interface to notify the application and refresh the singleton</li>
  <li>Make the singleton expire after a set time thus forcing a refresh</li>
  </ol>
  
  <p>I think option 7 (singleton expiration) would be ideal, but after reviewing <a href="http://www.castleproject.org/container/documentation/trunk/manual/windsorconfigref.html" rel="nofollow">Castle documentation</a> it would seem that an expiration feature is not yet available.  The <a href="http://www.castleproject.org/container/documentation/trunk/usersguide/lifestyles.html" rel="nofollow">custom lifestyle</a> seems like a possible solution but I don't see how I could implement it.</p>
  
  <p>Does anyone have any suggestions on how to implement options 6 or 7?  Maybe there is another solution out there?</p>