Interface IKeyValueStore
An interface which abstracts methods related to reading and writing string content to a persistent file storage.
Namespace: Unity.Cloud.Common
Syntax
public interface IKeyValueStore
Methods
DeleteCacheAsync(String)
A Task that deletes a unique filename in the current IKeyValueStore.
Declaration
Task DeleteCacheAsync(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filename | The unique filename to delete from the current IKeyValueStore. |
Returns
| Type | Description |
|---|---|
| Task | A Task that deletes a unique filename in the current IKeyValueStore. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the filename is null or empty. |
ReadCacheAsync(String)
A Task that reads a cached string from the current IKeyValueStore.
Declaration
Task<string> ReadCacheAsync(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filename | The unique filename to look for in the current IKeyValueStore. |
Returns
| Type | Description |
|---|---|
| Task<String> | A Task that results in the cached string value. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the filename is null or empty. |
| FileNotFoundException | Thrown if the filename does not exist. |
ValidateFilenameExistsAsync(String)
A Task that validates if a filename exists in the IKeyValueStore.
Declaration
Task<bool> ValidateFilenameExistsAsync(string filename)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filename | The unique filename to look for in the current IKeyValueStore. |
Returns
| Type | Description |
|---|---|
| Task<Boolean> | A task that has a result of true if the filename is found, false otherwise. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the filename is null or empty. |
WriteToCacheAsync(String, String)
A Task that writes a string content value under a unique filename in the current IKeyValueStore.
Declaration
Task WriteToCacheAsync(string filename, string content)
Parameters
| Type | Name | Description |
|---|---|---|
| String | filename | The unique filename that will hold the content value in the current IKeyValueStore. |
| String | content | The string content to write. |
Returns
| Type | Description |
|---|---|
| Task | A Task that writes a string content value under a unique filename in the current IKeyValueStore. |
Remarks
Overwrite any previous value.
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if the filename is null or empty. |