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); }); }
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); }
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)); }
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); }