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