realised the user can just set the region..delete time

This commit is contained in:
Tom Gardham-Pallister
2017-06-28 08:17:48 +01:00
parent 0fa759c76c
commit ab953f28fd
10 changed files with 86 additions and 12 deletions

View File

@ -12,9 +12,9 @@ namespace Ocelot.Cache
{
public string Region(ReRoute reRoute)
{
var methods = string.Join(",", reRoute.UpstreamHttpMethod.Select(m => m.Method));
var methods = string.Join("", reRoute.UpstreamHttpMethod.Select(m => m.Method));
var region = $"{methods} {reRoute.UpstreamPathTemplate.Value}";
var region = $"{methods}{reRoute.UpstreamPathTemplate.Value.Replace("/", "")}";
return region;
}

View File

@ -0,0 +1,13 @@
using System.Collections.Generic;
namespace Ocelot.Cache
{
public class Regions
{
public Regions(List<string> value)
{
Value = value;
}
public List<string> Value {get;private set;}
}
}

View File

@ -8,5 +8,6 @@
}
public int TtlSeconds { get; private set; }
public string Region {get;private set;}
}
}

View File

@ -3,5 +3,6 @@
public class FileCacheOptions
{
public int TtlSeconds { get; set; }
public string Region {get;private set;}
}
}

View File

@ -1,4 +1,5 @@
using System.Net.Http;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Ocelot.Cache;
@ -20,10 +21,10 @@ namespace Ocelot.Controllers
}
[HttpGet]
public IActionResult Get()
public async Task<IActionResult> Get()
{
var regions = _regionsGetter.Regions();
return new OkObjectResult(regions);
var regions = await _regionsGetter.Regions();
return new OkObjectResult(new Regions(regions));
}
[HttpDelete]