Beispiel #1
0
 private void TryDestroyCacheHandle()
 {
     if (this._cacheHandle != IntPtr.Zero)
     {
         LevelDBInterop.leveldb_cache_destroy(this._cacheHandle);
         this._cacheHandle = IntPtr.Zero;
     }
 }
Beispiel #2
0
        public void Cache()
        {
            LevelDBInterop.leveldb_close(Database);
            Database = IntPtr.Zero;

            // open the DB with a cache that is not owned by LevelDB, then
            // close DB and then free the cache
            var options = LevelDBInterop.leveldb_options_create();
            var cache   = LevelDBInterop.leveldb_cache_create_lru((IntPtr)64);

            LevelDBInterop.leveldb_options_set_cache(options, cache);
            IntPtr error;

            Database = LevelDBInterop.leveldb_open(options, DatabasePath, out error);
            LevelDBException.Check(error);
            LevelDBInterop.leveldb_close(Database);
            Database = IntPtr.Zero;

            LevelDBInterop.leveldb_cache_destroy(cache);
            LevelDBInterop.leveldb_options_destroy(options);
        }
Beispiel #3
0
 internal override void DestroyUnmanaged()
 {
     LevelDBInterop.leveldb_cache_destroy(_handle);
 }