// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace CommunityToolkit.Helpers;
///
/// Service interface used to store data using key value pairs.
///
/// The type of keys to use for accessing values.
public interface ISettingsStorageHelper
where TKey : notnull
{
///
/// Retrieves a single item by its key.
///
/// Type of object retrieved.
/// Key of the object.
/// The object for key.
/// A boolean indicator of success.
bool TryRead(TKey key, out TValue? value);
///
/// Saves a single item by its key.
///
/// Type of object saved.
/// Key of the value saved.
/// Object to save.
void Save(TKey key, TValue value);
///
/// Deletes a single item by its key.
///
/// Key of the object.
/// A boolean indicator of success.
bool TryDelete(TKey key);
///
/// Clear all keys and values from the settings store.
///
void Clear();
}