Skip to content

Commit

Permalink
#529 removed cache manager specific code (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
TomPallister authored Aug 11, 2018
1 parent 2673aeb commit d4b6519
Show file tree
Hide file tree
Showing 21 changed files with 213 additions and 1,099 deletions.
21 changes: 20 additions & 1 deletion src/Ocelot/Cache/IOcelotCache.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;

namespace Ocelot.Cache
{
Expand All @@ -9,5 +8,25 @@ public interface IOcelotCache<T>
void AddAndDelete(string key, T value, TimeSpan ttl, string region);
T Get(string key, string region);
void ClearRegion(string region);
}

public class NoCache<T> : IOcelotCache<T>
{
public void Add(string key, T value, TimeSpan ttl, string region)
{
}

public void AddAndDelete(string key, T value, TimeSpan ttl, string region)
{
}

public void ClearRegion(string region)
{
}

public T Get(string key, string region)
{
return default(T);
}
}
}
24 changes: 10 additions & 14 deletions src/Ocelot/Cache/Middleware/OutputCacheMiddleware.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,25 @@
using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Ocelot.Logging;
using Ocelot.Middleware;
using System.IO;
using Ocelot.Middleware.Multiplexer;

namespace Ocelot.Cache.Middleware
namespace Ocelot.Cache.Middleware
{
using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Ocelot.Logging;
using Ocelot.Middleware;
using System.IO;

public class OutputCacheMiddleware : OcelotMiddleware
{
private readonly OcelotRequestDelegate _next;
private readonly IOcelotCache<CachedResponse> _outputCache;
private readonly IRegionCreator _regionCreator;

public OutputCacheMiddleware(OcelotRequestDelegate next,
IOcelotLoggerFactory loggerFactory,
IOcelotCache<CachedResponse> outputCache,
IRegionCreator regionCreator)
IOcelotCache<CachedResponse> outputCache)
:base(loggerFactory.CreateLogger<OutputCacheMiddleware>())
{
_next = next;
_outputCache = outputCache;
_regionCreator = regionCreator;
}

public async Task Invoke(DownstreamContext context)
Expand Down
44 changes: 0 additions & 44 deletions src/Ocelot/Cache/OcelotCacheManagerCache.cs

This file was deleted.

26 changes: 13 additions & 13 deletions src/Ocelot/Cache/Regions.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
using System.Collections.Generic;

namespace Ocelot.Cache
{
public class Regions
{
public Regions(List<string> value)
{
Value = value;
}

public List<string> Value {get;private set;}
}
namespace Ocelot.Cache
{
using System.Collections.Generic;

public class Regions
{
public Regions(List<string> value)
{
Value = value;
}

public List<string> Value { get; }
}
}
5 changes: 3 additions & 2 deletions src/Ocelot/Configuration/CacheOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public CacheOptions(int ttlSeconds, string region)
Region = region;
}

public int TtlSeconds { get; private set; }
public string Region {get;private set;}
public int TtlSeconds { get; private set; }

public string Region { get; private set; }
}
}
3 changes: 0 additions & 3 deletions src/Ocelot/DependencyInjection/IOcelotBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using CacheManager.Core;
using System;
using System.Net.Http;
using IdentityServer4.AccessTokenValidation;
Expand All @@ -14,8 +13,6 @@ public interface IOcelotBuilder
IConfiguration Configuration { get; }
IOcelotBuilder AddStoreOcelotConfigurationInConsul();

IOcelotBuilder AddCacheManager(Action<ConfigurationBuilderCachePart> settings);

IOcelotAdministrationBuilder AddAdministration(string path, string secret);

IOcelotAdministrationBuilder AddAdministration(string path, Action<IdentityServerAuthenticationOptions> configOptions);
Expand Down
Loading

0 comments on commit d4b6519

Please sign in to comment.