Esempio n. 1
0
        private static void StoreFile(string path)
        {
            string key   = path;
            string value = String.Empty;

            byte[] buffer = File.ReadAllBytes(path);

            LMDBEnvironment _env;
            string          dir = "c:\\temp\\cache_net10B";

            _env = new LMDBEnvironment(dir);
            _env.MaxDatabases = 2;
            _env.MapSize      = 10485760 * 100;
            _env.Open();

            DateTime dtStart = DateTime.Now;
            var      tx      = _env.BeginTransaction();
            var      db      = tx.OpenDatabase("DB", new DatabaseConfiguration {
                Flags = DatabaseOpenFlags.Create
            });
            var enc = System.Text.Encoding.UTF8;

            tx.Put(db, enc.GetBytes(key), buffer);
            tx.Commit();
            db.Dispose();

            DateTime dtStop = DateTime.Now;
            TimeSpan ts     = dtStop - dtStart;
            string   str    = String.Format("Time elapsed for set:{0} ms", ts.TotalMilliseconds);

            Logger.LogInfo(str);

            _env.Dispose();
        }
Esempio n. 2
0
 public void Dispose()
 {
     if (disposed)
     {
         return;
     }
     disposed = true;
     databasesHolder.Dispose();
     indexesHolder.Dispose();
     environment.Dispose();
 }
Esempio n. 3
0
 public void Dispose()
 {
     try
     {
         _env.Dispose();
         Directory.Delete(_directory, true);
     }
     catch (Exception e)
     {
         Trace.TraceWarning(e.ToString());
     }
 }
Esempio n. 4
0
 /// <inheritdocs/>
 public void Dispose()
 {
     _stateDb.Dispose();
     _logDb.Dispose();
     _env.Dispose();
 }
Esempio n. 5
0
 public virtual void Dispose()
 {
     _allocatedDb.Dispose();
     _freeDb.Dispose();
     _env.Dispose();
 }