-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3601834
commit 9786803
Showing
9 changed files
with
116 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 3 additions & 10 deletions
13
src/Uno.Extensions.Storage.UI/ServiceCollectionExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 1 addition & 23 deletions
24
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageConfiguration.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,6 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
public record KeyValueStorageConfiguration : KeyValueStorageSettings | ||
internal record KeyValueStorageConfiguration : KeyValueStorageSettings | ||
{ | ||
public IDictionary<string, KeyValueStorageSettings> Providers { get; init; } = new Dictionary<string, KeyValueStorageSettings>(); | ||
|
||
|
||
} | ||
|
||
internal static class KeyValueStorageConfigurationExtensions | ||
{ | ||
public static KeyValueStorageSettings GetSettingsOrDefault(this KeyValueStorageConfiguration? config, string name) | ||
{ | ||
if (config?.Providers.TryGetValue(name, out var settings) ?? false) | ||
{ | ||
return settings; | ||
} | ||
|
||
// If there isn't a match for settings for the supplied name, return | ||
// the default settings | ||
return config ?? new KeyValueStorageSettings(); | ||
} | ||
} | ||
|
||
public record KeyValueStorageSettings | ||
{ | ||
public bool DisableInMemoryCache { get; init; } | ||
} |
16 changes: 16 additions & 0 deletions
16
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageConfigurationExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
internal static class KeyValueStorageConfigurationExtensions | ||
{ | ||
public static KeyValueStorageSettings GetSettingsOrDefault(this KeyValueStorageConfiguration? config, string name) | ||
{ | ||
if (config?.Providers.TryGetValue(name, out var settings) ?? false) | ||
{ | ||
return settings; | ||
} | ||
|
||
// If there isn't a match for settings for the supplied name, return | ||
// the default settings | ||
return config ?? new KeyValueStorageSettings(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Uno.Extensions.Storage/KeyValueStorage/KeyValueStorageSettings.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Uno.Extensions.Storage.KeyValueStorage; | ||
|
||
/// <summary> | ||
/// Record for storing settings for a key value storage provider. | ||
/// </summary> | ||
public record KeyValueStorageSettings | ||
{ | ||
/// <summary> | ||
/// Gets or sets whether in-memory cache should be disabled. | ||
/// </summary> | ||
public bool DisableInMemoryCache { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters