// GET api/<controller> public IEnumerable <CalendarEvent> Get() { if (_cachedEvents == null) { _cachedEvents = new ExpiringCache <IEnumerable <CalendarEvent> >(GetEvents(null, null), TimeSpan.FromMinutes(int.Parse(ConfigurationManager.AppSettings["GoogleCalendarMinutesToCacheEvents"]))); } else if (_cachedEvents.IsExpired()) { _cachedEvents.Refresh(GetEvents(null, null)); } return(_cachedEvents.Item); }