Ejemplo n.º 1
0
 public void Visit(Action <K, V> visitor)
 {
     Adapter.Visit((keyBytes, valBytes) =>
     {
         var key = Serialization.Unserialize <K>(keyBytes);
         var val = Serialization.Unserialize <V>(valBytes);
         visitor(key, val);
     });
 }
Ejemplo n.º 2
0
 public void Visit(Action <K, V> visitor, ulong searchCount = 0, byte[] prefix = null)
 {
     Adapter.Visit((keyBytes, valBytes) =>
     {
         var key = Serialization.Unserialize <K>(keyBytes);
         var val = Serialization.Unserialize <V>(valBytes);
         visitor(key, val);
     }, searchCount, prefix);
 }
Ejemplo n.º 3
0
        public V Get(K key)
        {
            var keyBytes = Serialization.Serialize(key);
            var bytes    = Adapter.GetValue(keyBytes);

            if (bytes == null)
            {
                Throw.If(bytes == null, "item not found in keystore");
            }
            return(Serialization.Unserialize <V>(bytes));
        }
Ejemplo n.º 4
0
        public bool TryGet(K key, out V value)
        {
            var keyBytes = Serialization.Serialize(key);
            var bytes    = Adapter.GetValue(keyBytes);

            if (bytes == null)
            {
                value = default(V);
                return(false);
            }
            value = Serialization.Unserialize <V>(bytes);
            return(true);
        }