Skip to content

Commit

Permalink
RZCache InMemory caching
Browse files Browse the repository at this point in the history
Use InMemory caching for short therm caching operations
  • Loading branch information
rzander committed Aug 29, 2017
1 parent d29e802 commit 7a3ebd1
Show file tree
Hide file tree
Showing 5 changed files with 285 additions and 119 deletions.
9 changes: 7 additions & 2 deletions RZ.Cache/RZCache/Controllers/ValuesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Reflection;
using System.Net.Http;
using System.Net.Http.Headers;
using Microsoft.Extensions.Caching.Memory;

namespace RZWCF.Controllers
{
Expand Down Expand Up @@ -53,17 +54,22 @@ public string get()

}


[Route("/rest")]
public class RZController : Controller
{
private readonly IConfiguration _config;
private IMemoryCache _cache;

public RZController(IConfiguration config)
public RZController(IConfiguration config, IMemoryCache memoryCache)
{
this._config = config;
_cache = memoryCache;

RuckZuck_WCF.RZRestProxy.sURL = config.GetSection("ParentServer").Value ?? _config.GetSection("RuckZuck:ParentServer").Value;
RuckZuck_WCF.RZRestProxy.CatalogTTL = int.Parse(_config.GetSection("CatalogTTL").Value ?? _config.GetSection("RuckZuck:CatalogTTL").Value);
RuckZuck_WCF.RZRestProxy.localURL = config.GetSection("localURL").Value ?? _config.GetSection("RuckZuck:localURL").Value;
RuckZuck_WCF.RZRestProxy._cache = _cache;
}

[Route("AuthenticateUser")]
Expand Down Expand Up @@ -217,7 +223,6 @@ public Stream Dl(string contentid, string filename)
}
}


public class GetSoftware
{
public string ProductName { get; set; }
Expand Down
4 changes: 2 additions & 2 deletions RZ.Cache/RZCache/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public static void Main(string[] args)
var ClientEp = new IPEndPoint(IPAddress.Any, 0);
var ClientRequestData = Server.Receive(ref ClientEp);
var ClientRequest = Encoding.ASCII.GetString(ClientRequestData);

Console.WriteLine("Recived '{0}' from {1}, sending response", ClientRequest, ClientEp.Address.ToString());
Console.WriteLine("Discovery request from {0}...", ClientRequest);
Server.Send(ResponseData, ResponseData.Length, ClientEp);
}
});
Expand Down
Loading

0 comments on commit 7a3ebd1

Please sign in to comment.