Exemplo n.º 1
0
        public void Get()
        {
            var options = Native.leveldb_readoptions_create();

            Native.leveldb_put(Database, options, "key1", "value1");
            var value1 = Native.leveldb_get(Database, options, "key1");

            Assert.AreEqual("value1", value1);

            Native.leveldb_put(Database, options, "key2", "value2");
            var value2 = Native.leveldb_get(Database, options, "key2");

            Assert.AreEqual("value2", value2);

            Native.leveldb_put(Database, options, "key3", "value3");
            var value3 = Native.leveldb_get(Database, options, "key3");

            Assert.AreEqual("value3", value3);

            // verify checksums
            Native.leveldb_readoptions_set_verify_checksums(options, true);
            value1 = Native.leveldb_get(Database, options, "key1");
            Assert.AreEqual("value1", value1);

            // no fill cache
            Native.leveldb_readoptions_set_fill_cache(options, false);
            value2 = Native.leveldb_get(Database, options, "key2");
            Assert.AreEqual("value2", value2);

            Native.leveldb_readoptions_destroy(options);
        }