mirror of
https://github.com/nsnail/Ocelot.git
synced 2025-06-19 00:58:15 +08:00
realised the user can just set the region..delete time
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
13
src/Ocelot/Cache/Regions.cs
Normal file
13
src/Ocelot/Cache/Regions.cs
Normal 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;}
|
||||
}
|
||||
}
|
@ -8,5 +8,6 @@
|
||||
}
|
||||
|
||||
public int TtlSeconds { get; private set; }
|
||||
public string Region {get;private set;}
|
||||
}
|
||||
}
|
||||
|
@ -3,5 +3,6 @@
|
||||
public class FileCacheOptions
|
||||
{
|
||||
public int TtlSeconds { get; set; }
|
||||
public string Region {get;private set;}
|
||||
}
|
||||
}
|
||||
|
@ -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]
|
||||
|
Reference in New Issue
Block a user