SBarnes wrote:You read my mind as I was thinking how many changes I would have to make given one of our extensions of the api is about 9,000 lines of code. It would actually be good if there was a helper function where you could replace 1 line with 1 line, then a global search and replace would probably do it.
SBarnes wrote:Will the api continue support deployment to IIS (Azure Web App) if you are going for in memory caching, I suppose it should still work if session affinity is enabled if the web app scaled out?
[Authenticate]
public JiwaFinancials.Jiwa.JiwaServiceModel.Debtors.Debtor Get(DebtorGETRequest request)
{
JiwaApplication.Manager manager = this.GetManager();
JiwaServiceModel.Debtors.Debtor DTO = Helper.Service.GetCachedDTOFromMaintenanceBusinessLogic<JiwaServiceModel.Debtors.Debtor>(manager, this, request.DebtorID,
(a, b, c) =>
{
JiwaDebtors.Debtor Debtor = Helper.Service.GetMaintenanceBusinessLogic<JiwaDebtors.Debtor>(manager, this, request.DebtorID,
(d, m, s) =>
{
d.Read(request.DebtorID);
if (Helper.Service.IsStateful(s))
{
manager.ObjectDictionary.Add(d.DebtorID, d);
}
});
return Debtor.DTO_Serialise();
});
return DTO;
}
JiwaApplication.Manager manager = this.GetManager();
JiwaApplication.Manager manager = this.SessionAs<JiwaAuthUserSession>().Manager;
using System;
namespace JiwaFinancials.Jiwa.JiwaServiceModel
{
public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
{
// Get the cached routes dictionary from the IOC container
CachedRoutesDictionary cachedRoutes = Container.TryResolve<CachedRoutesDictionary>();
//cachedRoutes.Routes.Add("/Debtors/{DebtorID}", TimeSpan.FromDays(1)); // 1 Day expiry
cachedRoutes.Routes.Add("/Debtors/{DebtorID}", TimeSpan.Zero); // No expiry
}
}
}
JiwaApplication.Manager manager = this.SessionAs<JiwaAuthUserSession>().Manager;
SBarnes wrote:Well on the huge customisation that extended the web api that went live at the beginning of the yearmay not be a problem as there are only five occurrences so it looks like that bullet gets dodged.
- Code: Select all
JiwaApplication.Manager manager = this.SessionAs<JiwaAuthUserSession>().Manager;
SBarnes wrote:If you want when the caching is baked we can test it on this same client database in our development environment given it's a large database in size and has been customised with a level of complexity that if something is going to break things this will surely do it.
Mike.Sheen wrote:we plan to ship another 2 - one for Redis and one for Memcache - the only difference to the in-memory plugin will be the setup of a caching provider in the IOC container (I think - will know for sure when it's done).
using System;
using ServiceStack.Redis;
namespace JiwaFinancials.Jiwa.JiwaServiceModel
{
public class RESTAPIPlugin : System.MarshalByRefObject, JiwaFinancials.Jiwa.JiwaApplication.IJiwaRESTAPIPlugin
{
public void Configure(JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin, ServiceStack.ServiceStackHost AppHost, Funq.Container Container, JiwaApplication.Manager JiwaApplicationManager)
{
// Register Redis as the cache provider
Container.Register<IRedisClientsManager>(c => new RedisManagerPool("localhost:6379"));
Container.Register(c => c.Resolve<IRedisClientsManager>().GetCacheClient());
// Get the cached routes dictionary from the IOC container
CachedRoutesDictionary cachedRoutes = Container.TryResolve<CachedRoutesDictionary>();
//cachedRoutes.Routes.Add("/Debtors/{DebtorID}", TimeSpan.FromDays(1)); // 1 Day expiry
cachedRoutes.Routes.Add("/Debtors/{DebtorID}", TimeSpan.Zero); // No expiry
}
}
}
SBarnes wrote:and he's willing welcome to join in if he feels left out
SBarnes wrote:Of course the other question is how this will all perform once its put under some load
SBarnes wrote:I suppose anything that does an auto query and some paging would definitely make the cache grow fairly quickly which might be a good test or will auto query not cache?
Users browsing this forum: No registered users and 1 guest