Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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());
        }
Exemple #5
0
        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);
        }
Exemple #6
0
 public void Delete(Distributor item)
 {
     _databaseInstance.Delete(item, TableName);
     CachePools.Remove(CacheKeys.DistributorKey);
 }
Exemple #7
0
 public void Create(Distributor item)
 {
     item.DistributorId = _databaseInstance.Insert(item, TableName);
     CachePools.Remove(CacheKeys.DistributorKey);
 }
Exemple #8
0
 public void Refresh(string key)
 {
     CachePools.Remove(key);
 }