Skip to content

Commit

Permalink
Update Barrel.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno authored Mar 11, 2021
1 parent 19f7c98 commit 5c1a225
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/MonkeyCache.LiteDB/Barrel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Barrel : IBarrel
{
public static string ApplicationId { get; set; } = string.Empty;
public static string EncryptionKey { get; set; } = string.Empty;
public static bool Upgrade { get; set; } = false;

static readonly Lazy<string> baseCacheDir = new Lazy<string>(() =>
{
Expand Down Expand Up @@ -64,6 +65,8 @@ public static IBarrel Create(string cacheDirectory, bool cache = false)
if (!string.IsNullOrWhiteSpace(EncryptionKey))
path = $"Filename={path}; Password={EncryptionKey}";
#endif
if(Upgrade)
path += ";Upgrade=true ";

db = new LiteDatabase(path);
col = db.GetCollection<Banana>();
Expand Down Expand Up @@ -301,4 +304,4 @@ public void Empty(params string[] key)
}
#endregion
}
}
}

0 comments on commit 5c1a225

Please sign in to comment.