Skip to content

Instantly share code, notes, and snippets.

@mverzilli
Created March 27, 2012 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mverzilli/2216540 to your computer and use it in GitHub Desktop.
Save mverzilli/2216540 to your computer and use it in GitHub Desktop.
Original service method
public User GetUserByEmail(string email)
{
var key = email;
var user = Cache.Cache.Get<User>(key);
if (user == null)
{
try
{
user = builder.BuildFromNewDbs(email);
}
catch (UserNotFoundException)
{
try
{
user = builder.BuildFromOldDbs(email);
}
catch (UserNotFoundException e)
{
Trace.TraceError("Something failed because there's not a user with that email.", DateTime.Now, email);
throw new UserNotFoundException();
}
}
Cache.Cache.Set(key, user);
}
return user;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment