init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Runtime.Caching;
|
||||
using Kreta.Core.Logic;
|
||||
using Kreta.DataAccessManual;
|
||||
using Kreta.Naplo.Dao.V3.Naplo;
|
||||
|
||||
namespace Kreta.Naplo.BusinessLogic.V3.Intezmeny
|
||||
{
|
||||
internal static class IntezmenySubqueries
|
||||
{
|
||||
internal static IntezmenyAdatokDao GetIntezmenyAdatokFromCache(string intezmenyAzonosito)
|
||||
{
|
||||
var cache = MemoryCache.Default;
|
||||
var cacheKey = $"{intezmenyAzonosito}_mobileIntezmenyAdatok";
|
||||
|
||||
if (!(cache[cacheKey] is IntezmenyAdatokDao intezmenyAdatok))
|
||||
{
|
||||
intezmenyAdatok = new IntezmenyAdatokDao();
|
||||
|
||||
Dal.MobileConnection.Run(
|
||||
intezmenyAzonosito,
|
||||
null,
|
||||
h =>
|
||||
{
|
||||
intezmenyAdatok = h.IntezmenyDal().GetIntezmenyIdAktivTanevIdByAzonosito(intezmenyAzonosito).Tables[0].Rows[0].ToDao<IntezmenyAdatokDao>();
|
||||
});
|
||||
|
||||
var policy = new CacheItemPolicy
|
||||
{
|
||||
AbsoluteExpiration = new DateTimeOffset(DateTime.Now.AddMinutes(20))
|
||||
};
|
||||
|
||||
cache.Set(cacheKey, intezmenyAdatok, policy);
|
||||
}
|
||||
|
||||
return intezmenyAdatok;
|
||||
}
|
||||
|
||||
internal static void RemoveIntezemenyAdatokCache(string intezmenyAzonosito)
|
||||
{
|
||||
_ = MemoryCache.Default.Remove($"{intezmenyAzonosito}_mobileIntezmenyAdatok");
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue