I am trying to build a cache class using the Ardalis Example http://ardalis.com/introducing-the-cachedrepository-pattern
I am getting the error saying it has zero arguments. I can figure out how to pass the top part.
The cache part of the class has no errors and the base class works
What am i doing wrong in the top part of the respository class. How am i inheriting wrong.
Thank you for any help.
Repository Class with the problem
public class TweetSearchCache : TweetSearch
{
// SingleUserAuthorizer auth;
public TweetSearchCache() : base //(SingleUserAuthorizer auth)
{
}
private static readonly object CacheLockObject = new object();
public override List<Search> GetTweets()
{
string cacheKey = "GetSearch";
var result = HttpRuntime.Cache[cacheKey] as List<Search>;
if (result == null)
{
lock (CacheLockObject)
{
result = HttpRuntime.Cache[cacheKey] as List<Search>;
if (result == null)
{
result = base.GetTweets().ToList();
HttpRuntime.Cache.Insert(cacheKey, result, null,
DateTime.Now.AddMinutes(2), TimeSpan.Zero);
}
}
}
return result;
}
}
Base Class
public class TweetSearch
{
private readonly SingleUserAuthorizer _auth;
public TweetSearch(SingleUserAuthorizer auth)
{
_auth = auth;
}
public virtual List<Search> GetTweets()
{
string hashTerm = "#searchterm";
string rejectedWords = "Searchterm";
using (var twitterCtx = new TwitterContext(_auth))
{
var queryResults = (from search in twitterCtx.Search
where search.Type == SearchType.Search &&
search.Hashtag == hashTerm ||
// search.Query == twitQuery ||
// search.WordPhrase == twitPhrase ||
search.WordNot == rejectedWords &&
search.ShowUser == true &&
search.IncludeEntities == true &&
search.Locale == "EN" &&
search.PageSize == 100
select search).ToList();
return queryResults;//.ToList();
}
}