Exemple #1
0
        public BytesCapsule GetDynamic(byte[] dynamic_key)
        {
            BytesCapsule result = null;
            Key          key    = new Key(dynamic_key);

            if (this.dynamic_properties_cache.ContainsKey(key))
            {
                result = this.dynamic_properties_cache[key].ToCapsule <BytesCapsule, object>();
            }
            else
            {
                if (this.parent != null)
                {
                    result = this.parent.GetDynamic(dynamic_key);
                }
                else
                {
                    try
                    {
                        result = this.db_manager.DynamicProperties.Get(dynamic_key);
                    }
                    catch
                    {
                        Logger.Warning("Not found dynamic property : " + dynamic_key.ToString());
                        result = null;
                    }
                }

                if (result != null)
                {
                    this.dynamic_properties_cache.Add(key, Value.Create(result.Data));
                }
            }

            return(result);
        }
Exemple #2
0
        public byte[] GetHash(byte[] hash)
        {
            BytesCapsule bytes = this.cache.Get(hash);

            return(bytes == null ? null : bytes.Data);
        }