Skip to content

Instantly share code, notes, and snippets.

@steff-mueller
Created April 21, 2012 11:23
Show Gist options
  • Save steff-mueller/2436685 to your computer and use it in GitHub Desktop.
Save steff-mueller/2436685 to your computer and use it in GitHub Desktop.
public class TweetsService : RestServiceBase<Tweets>
{
public ICacheClient Cache { get; set; }
public object OnGet(Tweets request)
{
var tweets = this.Cache.Get<List<Tweets>>("yourkey");
if(tweets == null)
{
tweets = LoadTweetsFromExternalService();
this.Cache.Add<List<Tweets>>("yourkey", tweets);
}
return tweets.Take(request.Count);
}
}
public class TweetsService : RestServiceBase<Tweets>
{
public ICacheClient Cache { get; set; }
public object OnGet(Tweets request)
{
var tweets = this.Cache.Get<List<Tweets>>("yourkey");
if(tweets == null)
{
tweets = LoadTweetsFromExternalService();
this.Cache.Add<List<Tweets>>("yourkey", tweets);
}
return tweets.Take(request.Count);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment