Flush() public method

Flushes the Environment
This method wraps the native ups_env_flush function.
This function flushes the Database cache and writes the whole file to disk.
Since In-Memory Environments do not have a file on disk, the function will have no effect and will return successfully.
public Flush ( ) : void
return void
Exemplo n.º 1
0
 private void Flush()
 {
     Upscaledb.Environment env = new Upscaledb.Environment();
     env.Create("ntest.db");
     env.Flush();
     env.Close();
 }
        public void Start(string context, int recordCount, int?threadCount = null)
        {
            Log.Clear();

            Context     = context;
            RecordCount = recordCount;
            ThreadCount = threadCount;
            var engine = GetType().Name;

            Log.AppendLine($"# Context: {Context} | Engine: {engine} | Records: {recordCount} | Threads: {threadCount}");

            var databaseName = $@"{context.Replace(" ", "_").ToLower()}_{engine.ToLower()}.db";

            if (Directory.Exists(databaseName))
            {
                Directory.Delete(databaseName, true);
            }

            var databasePath = Path.Combine(System.Environment.CurrentDirectory, databaseName);

            var environment = new Upscaledb.Environment();
            var db          = new Database();

            environment.Create(databaseName);
            db = environment.CreateDatabase(1);

            var stopWatch = new Stopwatch();

            stopWatch.Start();

            _actions.ForEach(action => action(db));

            stopWatch.Stop();

            environment.Flush();
            environment.Close();
            db.Close();

            Log.AppendFormat("# Context: {0} | Engine: {1} | Total time: {2:hh\\:mm\\:ss\\.ffff}\n", Context, engine, stopWatch.Elapsed);
            Log.AppendLine("\n");
        }
Exemplo n.º 3
0
 private void Flush()
 {
     Upscaledb.Environment env = new Upscaledb.Environment();
     env.Create("ntest.db");
     env.Flush();
     env.Close();
 }