microsoft / ManagedEsent

MIT License
244 stars 36 forks source link

PersistentDictionary max file size #37

Closed jeremy-collette closed 4 years ago

jeremy-collette commented 4 years ago

Hi all,

I've been trying to work out how to somehow configure the PersistentDictionary to limit the max file on disk. I've looked at DatabaseConfig.cs and played around, but no luck.

Any suggestions?

Cheers

jeremy-collette commented 4 years ago

Ah! I should have endured for another 5 minutes. I was able to limit the filesize using a combination of the DatabasePageSize and DatabaseMaxPages properties of the DatabaseConfig linked above.

e.g.

var config = new DatabaseConfig();
config.DatabasePageSize = 4096;
config.DatabaseMaxPages = 2000;

var persistentDictionary = new PersistentDictionary<string, string>(
                directory: "Test",
                customConfig: config);