I guess it suits your needs more than the Sliding type. Remember that the cache will expire the entry after the amount of time you setted, even if no access happend.
Hi,
Isn't the definition of a "sliding cache" is that it doesn't recalculate data until it hasn't been accessed for the "slidingTimeExpiration" ?
If it's set to 30s and you're accessing it every 10s, it will never recalculate data.
Thank you for your answer Hikalkan.
Honestly, I don't know how to do this, I don't fully understand how works all this injection principle with Castle Windsor. Could you point me to an example code of this ?
What I try to acheive with HangFire is to use a background job instead of a windows service. Is it such a bad idea ? I need something which runs every x minutes, update some data in the database, then get data from it, and finally insert some data in. When you're talking about using a domain service where the logic would be, are you talking about the "Core" domain of the template ? You're meaning that my background job should "talk" directly to the "Core" instead of the application service ?
I found a way, in the RecurrentJobs.cs file, using the "Object.UnitOfWorkManager" of my appService.
[...]
public void LaunchJobsRecurrentFiveMinutes()
{
[...]
using (var messageService = _iocResolver.ResolveAsDisposable<MessageAppService>())
{
var source = LocalizationHelper.Manager.GetSource("MyProject");
using (var unitOfWork = messageService.Object.UnitOfWorkManager.Begin())
{
foreach (var concoursId in retourMajQualif.ListeIdConcoursQualifMaj)
{
messageService.Object.AjouterMessageSysteme(
new AjouterMessageInput
{
ConcoursId = concoursId,
Contenu = source.GetString("finQualifications")
});
}
unitOfWork.Complete();
}
}
[...]
}
}
[...]
I hope it's not bad coding, and if it's not, that it could help someone else !