title: Optimal way to cache time of day description
body: <p>What is the best method to cache the following? I am creating an intranet web application template that will display the message, e.g., <strong>Good Morning, Justin Satyr!</strong> near the top of my master page header. Obviously, I will have to determine whether to show <strong>Morning</strong>, <strong>Afternoon</strong> or <strong>Evening</strong>. For clarity, my code is below:</p>
  
  <pre><code>string partOfDay;
  var hours = DateTime.Now.Hour;
  if (hours &gt; 16)
  {
      partOfDay = "evening";
  }
  else if (hours &gt; 11)
  {
      partOfDay = "afternoon";
  }
  else
  {
      partOfDay = "morning";
  }
  </code></pre>
  
  <p>I do not want to re-determine this on each page load because that seems moderately redundant and because I have to poll a SQL server to retrieve the user's full name. What is the best way to cache this information?  If I cache it for the length of the session, then if the user begins using the application at 11:00 AM and finishes at 3:00 PM, it will still say <strong>Good Morning</strong>.</p>
  
  <p>Is the best thing to do simply re-determine the M/A/E word each page load and cache the person's full name for the session? Or is there a better way?</p>