private List <PosEndPoint> EnsureShopAndPos() { var poses = (List <PosEndPoint>)CachePools.GetData(CacheKeys.PosKey); if (poses == null) { lock (PosAndShopsLocker) { poses = (List <PosEndPoint>)CachePools.GetData(CacheKeys.PosKey); if (poses == null) { poses = GetPosAndShops(); CachePools.AddCache(CacheKeys.PosKey, poses); } } } return(poses); }
public IEnumerable <AccountType> GetAccounTypes() { string key = CacheKeys.PointPolicyKey; var items = (Point_Level_Type)CachePools.GetData(key); if (items == null) { lock (PointPoliciesLocker) { items = (Point_Level_Type)CachePools.GetData(key); if (items == null) { items = InnerGetPointPolicies(); CachePools.AddCache(key, items); } } } return(items.AccountTypes); }
public IEnumerable <Distributor> Query() { string key = CacheKeys.DistributorKey; var items = (List <Distributor>)CachePools.GetData(key); if (items == null) { lock (Locker) { items = (List <Distributor>)CachePools.GetData(key); if (items == null) { items = InnerQuery(); CachePools.AddCache(key, items); } } } return(items); }
public IEnumerable <AmountRate> GetAmountRate() { string key = CacheKeys.AmountRateKey; List <AmountRate> items = (List <AmountRate>)CachePools.GetData(key); if (items == null) { lock (AmountRateLocker) { items = (List <AmountRate>)CachePools.GetData(key); if (items == null) { items = new List <AmountRate>(InnerGetAmountRates()); CachePools.AddCache(key, items); } } } return(items.AsEnumerable()); }
public Site GetSite() { string key = CacheKeys.SiteKey; Site site = (Site)CachePools.GetData(key); if (site == null) { lock (SiteLocker) { site = (Site)CachePools.GetData(key); if (site == null) { site = InnerGetSite(); CachePools.AddCache(key, site); } } } return(site); }
public void Delete(Distributor item) { _databaseInstance.Delete(item, TableName); CachePools.Remove(CacheKeys.DistributorKey); }
public void Create(Distributor item) { item.DistributorId = _databaseInstance.Insert(item, TableName); CachePools.Remove(CacheKeys.DistributorKey); }
public void Refresh(string key) { CachePools.Remove(key); }