Skip to content

LocalStorage

Summary

Represents the local storage API.

Signature

1
public abstract interface LocalStorage

Namespace

cAlgo.API

Methods

SetString (2)

SetString (1 of 2)

Summary

Saves a string value to local storage. The storage scope is LocalStorageScope.Instance.

Signature

1
public abstract void SetString(string key, string value)

Parameters

Name Type Description
key string The key of the element to add, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
value string The value of the element to add

Return Value

void

SetString (2 of 2)

Summary

Saves a string value to local storage.

Signature

1
public abstract void SetString(string key, string value, LocalStorageScope localStorageScope)

Parameters

Name Type Description
key string The key of the element to add, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
value string The value of the element to add
localStorageScope LocalStorageScope The storage scope of the element

Return Value

void

SetObject (2)

SetObject (1 of 2)

Summary

Saves an object to local storage. The storage scope is LocalStorageScope.Instance.

Signature

1
public abstract void SetObject(string key, object obj)

Parameters

Name Type Description
key string The key of the element to add, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
obj object The object of the element to add

Return Value

void

SetObject (2 of 2)

Summary

Saves an object to local storage.

Signature

1
public abstract void SetObject(string key, object obj, LocalStorageScope localStorageScope)

Parameters

Name Type Description
key string The key of the element to add, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
obj object The object of the element to add
localStorageScope LocalStorageScope The storage scope of the element

Return Value

void

GetString (2)

GetString (1 of 2)

Summary

Gets a string value from local storage.This method will search all available scopes (Instance -> Type -> Device) and stops on first found value.

Signature

1
public abstract string GetString(string key)

Parameters

Name Type Description
key string The key of the element to get, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end

Return Value

string

GetString (2 of 2)

Summary

Gets a string value from local storage.

Signature

1
public abstract string GetString(string key, LocalStorageScope localStorageScope)

Parameters

Name Type Description
key string The key of the element to get, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
localStorageScope LocalStorageScope The storage scope of the element

Return Value

string

GetObject (2)

GetObject (1 of 2)

Summary

Gets an object from local storage.This method will search all available scopes (Instance -> Type -> Device) and stops on first found value.

Signature

1
public abstract T GetObject(string key)

Parameters

Name Type Description
key string The key of the element to get, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end

Return Value

T

GetObject (2 of 2)

Summary

Gets an object from local storage.

Signature

1
public abstract T GetObject(string key, LocalStorageScope localStorageScope)

Parameters

Name Type Description
key string The key of the element to get, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
localStorageScope LocalStorageScope The storage scope of the element

Return Value

T

Remove (2)

Remove (1 of 2)

Summary

Removes an element from local storage.This method will search all available scopes (Instance -> Type -> Device) and stops on first found value.

Signature

1
public abstract void Remove(string key)

Parameters

Name Type Description
key string The key of the element to remove, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end

Return Value

void

Remove (2 of 2)

Summary

Removes an element from local storage.

Signature

1
public abstract void Remove(string key, LocalStorageScope localStorageScope)

Parameters

Name Type Description
key string The key of the element to remove, max length for keys is 50 characters, and only alphanumeric and space characters are allowed, you can only use space in the middle of key not at the start or end
localStorageScope LocalStorageScope The storage scope of the element

Return Value

void

Flush

Summary

Saves all data to the disk. When using local storage, data is automatically saved every minute. Use this method if you want to save data without delays.

Signature

1
public abstract void Flush(LocalStorageScope localStorageScope)

Parameters

Name Type Description
localStorageScope LocalStorageScope The storage scope to save to disk

Return Value

void

Reload

Summary

Reloads all values from the disk. When calling this method, unsaved pending changes may be lost. To avoid losing information, call the Flush() method first.

Signature

1
public abstract void Reload(LocalStorageScope localStorageScope)

Parameters

Name Type Description
localStorageScope LocalStorageScope The storage scope to reload

Return Value

void