2021-02-18 11:06:02 +01:00
|
|
|
|
namespace Umbraco.Cms.Core.Services
|
2017-12-22 12:29:56 +01:00
|
|
|
|
{
|
2018-03-21 11:32:07 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Manages the simplified key/value store.
|
|
|
|
|
|
/// </summary>
|
2017-12-22 12:29:56 +01:00
|
|
|
|
public interface IKeyValueService
|
|
|
|
|
|
{
|
2018-03-21 11:32:07 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Gets a value.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>Returns <c>null</c> if no value was found for the key.</remarks>
|
2017-12-22 12:29:56 +01:00
|
|
|
|
string GetValue(string key);
|
2018-03-21 11:32:07 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sets a value.
|
|
|
|
|
|
/// </summary>
|
2017-12-22 12:29:56 +01:00
|
|
|
|
void SetValue(string key, string value);
|
2018-03-21 11:32:07 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Sets a value.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>Sets the value to <paramref name="newValue"/> if the value is <paramref name="originValue"/>,
|
|
|
|
|
|
/// and returns true; otherwise throws an exception. In other words, ensures that the value has not changed
|
|
|
|
|
|
/// before setting it.</remarks>
|
2017-12-22 12:29:56 +01:00
|
|
|
|
void SetValue(string key, string originValue, string newValue);
|
2018-03-21 11:32:07 +01:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Tries to set a value.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <remarks>Sets the value to <paramref name="newValue"/> if the value is <paramref name="originValue"/>,
|
|
|
|
|
|
/// and returns true; otherwise returns false. In other words, ensures that the value has not changed
|
|
|
|
|
|
/// before setting it.</remarks>
|
|
|
|
|
|
bool TrySetValue(string key, string originValue, string newValue);
|
2017-12-22 12:29:56 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|