Пример #1
0
        public AttributeValue GetById(int id, bool isCache = true)
        {
            AttributeValue attributeValue;

            if (isCache)
            {
                var sbKey = new StringBuilder();
                sbKey.AppendFormat(CacheAttributevalueKey, "GetById");
                sbKey.Append(id);

                var key = sbKey.ToString();
                attributeValue = _cacheManager.Get <AttributeValue>(key);
                if (attributeValue == null)
                {
                    attributeValue = _attributeValueRepository.GetById(id);
                    _cacheManager.Put(key, attributeValue);
                }
            }
            else
            {
                attributeValue = _attributeValueRepository.GetById(id);
            }

            return(attributeValue);
        }