Got the search finished up for #32

This commit is contained in:
tidusjar 2016-04-01 23:05:17 +01:00
parent 420e43dfaf
commit e037ad0f2b
8 changed files with 118 additions and 18 deletions

View file

@ -37,13 +37,11 @@ namespace PlexRequests.Store.Repository
public class RequestJsonRepository : IRequestRepository
{
private ICacheProvider Cache { get; }
private string TypeName { get; }
public RequestJsonRepository(ISqliteConfiguration config, ICacheProvider cacheProvider)
{
Db = config;
Cache = cacheProvider;
TypeName = typeof(RequestJsonRepository).Name;
}
private ISqliteConfiguration Db { get; }
@ -60,7 +58,7 @@ namespace PlexRequests.Store.Repository
public IEnumerable<RequestBlobs> GetAll()
{
var key = TypeName + "GetAll";
var key = "GetAll";
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
@ -74,7 +72,7 @@ namespace PlexRequests.Store.Repository
public RequestBlobs Get(int id)
{
var key = TypeName + "Get" + id;
var key = "Get" + id;
var item = Cache.GetOrSet(key, () =>
{
using (var con = Db.DbConnection())
@ -107,7 +105,7 @@ namespace PlexRequests.Store.Repository
private void ResetCache()
{
Cache.Remove("Get");
Cache.Remove(TypeName + "GetAll");
Cache.Remove("GetAll");
}
public bool UpdateAll(IEnumerable<RequestBlobs> entity)