docs.unity3d.com
    Show / Hide Table of Contents

    Class FileKeyValueStore

    An IKeyValueStore implementation that uses text files for storage.

    Inheritance
    Object
    FileKeyValueStore
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Cloud.Common
    Syntax
    public class FileKeyValueStore : IKeyValueStore

    Constructors

    FileKeyValueStore(String, IStringObfuscator)

    Creates a FileKeyValueStore instance.

    Declaration
    public FileKeyValueStore(string cacheFilePath, IStringObfuscator stringObfuscator = null)
    Parameters
    Type Name Description
    String cacheFilePath

    The platform-specific base path for all stored data.

    IStringObfuscator stringObfuscator

    The optional IStringObfuscator implementation.

    Methods

    DeleteCacheAsync(String)

    A Task that deletes a unique filename in the current IKeyValueStore.

    Declaration
    public async 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.

    Implements
    IKeyValueStore.DeleteCacheAsync(String)
    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
    public async 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.

    Implements
    IKeyValueStore.ReadCacheAsync(String)
    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
    public 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.

    Implements
    IKeyValueStore.ValidateFilenameExistsAsync(String)
    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
    public async 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.

    Implements
    IKeyValueStore.WriteToCacheAsync(String, String)
    Remarks

    Overwrite any previous value.

    Exceptions
    Type Condition
    ArgumentException

    Thrown if the filename is null or empty.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023