Created
July 5, 2012 14:11
-
-
Save RobGibbens/3053901 to your computer and use it in GitHub Desktop.
Cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public ActionResult Index() | |
{ | |
var repo = new Repository(); | |
var dto = repo.GetDtoById(1); // Note, this doesn't know about the cache at all | |
} | |
public class Repository() | |
{ | |
[Cache(Duration = 10)] | |
public DTO GetDtoById(int id) | |
{ | |
// if it gets here, go get data from database, note this doesn't know about the cache at all | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment