Show / Hide Table of Contents

Class MemoryKeyValueStore

Volatile in-memory key-value store.

It is useful for storing temporal small chains, e.g., fixtures for unit tests of game logic.

MemoryStore and MemoryKeyValueStore-backed TrieStateStore can be instantiated from a URI with memory: scheme using LoadStore(Uri), e.g.:

  • memory:
Inheritance
Object
MemoryKeyValueStore
Implements
IKeyValueStore
IDisposable
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Store.Trie
Assembly: Libplanet.Store.dll
Syntax
public sealed class MemoryKeyValueStore : IKeyValueStore, IDisposable

Methods

| Improve this Doc View Source

Delete(IEnumerable<KeyBytes>)

Delete multiple keys at once.

Declaration
public void Delete(IEnumerable<KeyBytes> keys)
Parameters
Type Name Description
IEnumerable<KeyBytes> keys

Keys to delete. The order of keys does not matter. Non-existent keys are ignored.

Explicit Interface Implementations

| Improve this Doc View Source

IKeyValueStore.Delete(in KeyBytes)

Deletes the given key. If the key does not exist, nothing happens.

Declaration
void IKeyValueStore.Delete(in KeyBytes key)
Parameters
Type Name Description
KeyBytes key

A key to delete.

| Improve this Doc View Source

IKeyValueStore.Exists(in KeyBytes)

Checks whether the given key exists in the store.

Declaration
bool IKeyValueStore.Exists(in KeyBytes key)
Parameters
Type Name Description
KeyBytes key

A key to check.

Returns
Type Description
Boolean

true if the key exists; otherwise, false.

| Improve this Doc View Source

IKeyValueStore.Get(in KeyBytes)

Gets the value associated with the specified key.

Declaration
byte[] IKeyValueStore.Get(in KeyBytes key)
Parameters
Type Name Description
KeyBytes key

The key whose value to get.

Returns
Type Description
Byte[]

The value associated with the specified key.

Exceptions
Type Condition
KeyNotFoundException

Thrown when the key is not found.

| Improve this Doc View Source

IKeyValueStore.ListKeys()

Volatile in-memory key-value store.

It is useful for storing temporal small chains, e.g., fixtures for unit tests of game logic.

MemoryStore and MemoryKeyValueStore-backed TrieStateStore can be instantiated from a URI with memory: scheme using LoadStore(Uri), e.g.:

  • memory:
Declaration
IEnumerable<KeyBytes> IKeyValueStore.ListKeys()
Returns
Type Description
IEnumerable<KeyBytes>
| Improve this Doc View Source

IKeyValueStore.Set(in KeyBytes, Byte[])

Sets the value to the key. If the key already exists, the value is overwritten.

Declaration
void IKeyValueStore.Set(in KeyBytes key, byte[] value)
Parameters
Type Name Description
KeyBytes key

The key of the value to set.

Byte[] value

The value to set.

| Improve this Doc View Source

IKeyValueStore.Set(IDictionary<KeyBytes, Byte[]>)

Sets all values in the given dictionary.

Declaration
void IKeyValueStore.Set(IDictionary<KeyBytes, byte[]> values)
Parameters
Type Name Description
IDictionary<KeyBytes, Byte[]> values

A values to set.

| Improve this Doc View Source

IDisposable.Dispose()

Volatile in-memory key-value store.

It is useful for storing temporal small chains, e.g., fixtures for unit tests of game logic.

MemoryStore and MemoryKeyValueStore-backed TrieStateStore can be instantiated from a URI with memory: scheme using LoadStore(Uri), e.g.:

  • memory:
Declaration
void IDisposable.Dispose()

Implements

IKeyValueStore
System.IDisposable
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium