Skip to content

KeyValueStore

The @effect/platform/KeyValueStore module provides a robust and effectful interface for managing key-value pairs. It supports asynchronous operations, ensuring data integrity and consistency, and includes built-in implementations for in-memory, file system-based, and schema-validated stores.

The module provides a single KeyValueStore tag, which acts as the gateway for interacting with the store.

1
import {
import KeyValueStore
KeyValueStore
} from "@effect/platform"
2
import {
import Effect
Effect
} from "effect"
3
4
const
const program: Effect.Effect<void, never, KeyValueStore.KeyValueStore>
program
=
import Effect
Effect
.
const gen: <YieldWrap<Tag<KeyValueStore.KeyValueStore, KeyValueStore.KeyValueStore>>, void>(f: (resume: Effect.Adapter) => Generator<...>) => Effect.Effect<...> (+1 overload)
gen
(function* () {
5
const
const kv: KeyValueStore.KeyValueStore
kv
= yield*
import KeyValueStore
KeyValueStore
.
namespace KeyValueStore const KeyValueStore: Tag<KeyValueStore.KeyValueStore, KeyValueStore.KeyValueStore>
KeyValueStore
6
7
// use `kv` to operate on the store
8
})

The KeyValueStore interface includes the following operations:

OperationDescription
getReturns the value as string of the specified key if it exists.
getUint8ArrayReturns the value as Uint8Array of the specified key if it exists.
setSets the value of the specified key.
removeRemoves the specified key.
clearRemoves all entries.
sizeReturns the number of entries.
modifyUpdates the value of the specified key if it exists.
modifyUint8ArrayUpdates the value of the specified key if it exists.
hasCheck if a key exists.
isEmptyCheck if the store is empty.
forSchemaCreate a SchemaStore for the specified schema.

Example

1
import {
2
(alias) interface KeyValueStore (alias) namespace KeyValueStore (alias) const KeyValueStore: Tag<KeyValueStore, KeyValueStore> import KeyValueStore
KeyValueStore
,
3
(alias) const layerMemory: Layer<KeyValueStore, never, never> import layerMemory
layerMemory
4
} from "@effect/platform/KeyValueStore"
5
import {
import Effect
Effect
} from "effect"
6
7
const
const program: Effect.Effect<void, PlatformError, KeyValueStore>
program
=
import Effect
Effect
.
const gen: <YieldWrap<Tag<KeyValueStore, KeyValueStore>> | YieldWrap<Effect.Effect<void, PlatformError, never>>, void>(f: (resume: Effect.Adapter) => Generator<...>) => Effect.Effect<...> (+1 overload)
gen
(function* () {
8
const
const kv: KeyValueStore
kv
= yield*
(alias) namespace KeyValueStore (alias) const KeyValueStore: Tag<KeyValueStore, KeyValueStore> import KeyValueStore
KeyValueStore
9
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.size: Effect.Effect<number, PlatformError, never>

Returns the number of entries.

size
)
10
// Output: 0
11
12
yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.set: (key: string, value: string | Uint8Array) => Effect.Effect<void, PlatformError>

Sets the value of the specified key.

set
("key", "value")
13
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.size: Effect.Effect<number, PlatformError, never>

Returns the number of entries.

size
)
14
// Output: 1
15
16
const
const value: Option<string>
value
= yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.get: (key: string) => Effect.Effect<Option<string>, PlatformError>

Returns the value of the specified key if it exists.

get
("key")
17
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(
const value: Option<string>
value
)
18
// Output: { _id: 'Option', _tag: 'Some', value: 'value' }
19
20
yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.remove: (key: string) => Effect.Effect<void, PlatformError>

Removes the specified key.

remove
("key")
21
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(yield*
const kv: KeyValueStore
kv
.
(property) KeyValueStore.size: Effect.Effect<number, PlatformError, never>

Returns the number of entries.

size
)
22
// Output: 0
23
})
24
25
import Effect
Effect
.
const runPromise: <void, PlatformError>(effect: Effect.Effect<void, PlatformError, never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<...>

Runs an `Effect` workflow, returning a `Promise` which resolves with the result of the workflow or rejects with an error.

runPromise
(
const program: Effect.Effect<void, PlatformError, KeyValueStore>
program
.
(method) Pipeable.pipe<Effect.Effect<void, PlatformError, KeyValueStore>, Effect.Effect<void, PlatformError, never>>(this: Effect.Effect<...>, ab: (_: Effect.Effect<void, PlatformError, KeyValueStore>) => Effect.Effect<...>): Effect.Effect<...> (+21 overloads)
pipe
(
import Effect
Effect
.
const provide: <KeyValueStore, never, never>(layer: Layer<KeyValueStore, never, never>) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<...> (+9 overloads)

Splits the context into two parts, providing one part using the specified layer/context/runtime and leaving the remainder `R0`

provide
(
(alias) const layerMemory: Layer<KeyValueStore, never, never> import layerMemory
layerMemory
)))

The module provides several built-in implementations of the KeyValueStore interface, available as layers, to suit different needs:

ImplementationDescription
In-Memory StorelayerMemory provides a simple, in-memory key-value store, ideal for lightweight or testing scenarios.
File System StorelayerFileSystem offers a file-based store for persistent storage needs.
Schema StorelayerSchema enables schema-based validation for stored values, ensuring data integrity and type safety.

The SchemaStore interface allows you to validate and parse values according to a defined schema. This ensures that all data stored in the key-value store adheres to the specified structure, enhancing data integrity and type safety.

Example

1
import {
2
(alias) interface KeyValueStore (alias) namespace KeyValueStore (alias) const KeyValueStore: Tag<KeyValueStore, KeyValueStore> import KeyValueStore
KeyValueStore
,
3
(alias) const layerMemory: Layer<KeyValueStore, never, never> import layerMemory
layerMemory
4
} from "@effect/platform/KeyValueStore"
5
import {
import Schema
Schema
} from "@effect/schema"
6
import {
import Effect
Effect
} from "effect"
7
8
// Define a schema for the values
9
const
const Person: Schema.Struct<{ name: typeof Schema.String; age: typeof Schema.Number; }>
Person
=
import Schema
Schema
.
function Struct<{ name: typeof Schema.String; age: typeof Schema.Number; }>(fields: { name: typeof Schema.String; age: typeof Schema.Number; }): Schema.Struct<{ name: typeof Schema.String; age: typeof Schema.Number; }> (+1 overload) namespace Struct
Struct
({
10
(property) name: typeof Schema.String
name
:
import Schema
Schema
.
(alias) class String export String
String
,
11
(property) age: typeof Schema.Number
age
:
import Schema
Schema
.
(alias) class Number export Number
Number
12
})
13
14
const
const program: Effect.Effect<void, PlatformError | ParseError, KeyValueStore>
program
=
import Effect
Effect
.
const gen: <YieldWrap<Tag<KeyValueStore, KeyValueStore>> | YieldWrap<Effect.Effect<void, PlatformError | ParseError, never>>, void>(f: (resume: Effect.Adapter) => Generator<...>) => Effect.Effect<...> (+1 overload)
gen
(function* () {
15
const
const kv: SchemaStore<{ readonly name: string; readonly age: number; }, never>
kv
= (yield*
(alias) namespace KeyValueStore (alias) const KeyValueStore: Tag<KeyValueStore, KeyValueStore> import KeyValueStore
KeyValueStore
).
(property) KeyValueStore.forSchema: <{ readonly name: string; readonly age: number; }, { readonly name: string; readonly age: number; }, never>(schema: Schema.Schema<{ readonly name: string; readonly age: number; }, { readonly name: string; readonly age: number; }, never>) => SchemaStore<...>

Create a SchemaStore for the specified schema.

forSchema
(
const Person: Schema.Struct<{ name: typeof Schema.String; age: typeof Schema.Number; }>
Person
)
16
17
// Create a value that adheres to the schema
18
const
const value: { name: string; age: number; }
value
= {
(property) name: string
name
: "Alice",
(property) age: number
age
: 30 }
19
yield*
const kv: SchemaStore<{ readonly name: string; readonly age: number; }, never>
kv
.
(property) SchemaStore<{ readonly name: string; readonly age: number; }, never>.set: (key: string, value: { readonly name: string; readonly age: number; }) => Effect.Effect<void, PlatformError | ParseError, never>

Sets the value of the specified key.

set
("user1",
const value: { name: string; age: number; }
value
)
20
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(yield*
const kv: SchemaStore<{ readonly name: string; readonly age: number; }, never>
kv
.
(property) SchemaStore<{ readonly name: string; readonly age: number; }, never>.size: Effect.Effect<number, PlatformError, never>

Returns the number of entries.

size
)
21
// Output: 1
22
23
// Retrieve the value
24
namespace console var console: Console

The `console` module provides a simple debugging console that is similar to the JavaScript console mechanism provided by web browsers. The module exports two specific components: * A `Console` class with methods such as `console.log()`, `console.error()` and `console.warn()` that can be used to write to any Node.js stream. * A global `console` instance configured to write to [`process.stdout`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstdout) and [`process.stderr`](https://nodejs.org/docs/latest-v22.x/api/process.html#processstderr). The global `console` can be used without importing the `node:console` module. _**Warning**_: The global console object's methods are neither consistently synchronous like the browser APIs they resemble, nor are they consistently asynchronous like all other Node.js streams. See the [`note on process I/O`](https://nodejs.org/docs/latest-v22.x/api/process.html#a-note-on-process-io) for more information. Example using the global `console`: ```js console.log('hello world'); // Prints: hello world, to stdout console.log('hello %s', 'world'); // Prints: hello world, to stdout console.error(new Error('Whoops, something bad happened')); // Prints error message and stack trace to stderr: // Error: Whoops, something bad happened // at [eval]:5:15 // at Script.runInThisContext (node:vm:132:18) // at Object.runInThisContext (node:vm:309:38) // at node:internal/process/execution:77:19 // at [eval]-wrapper:6:22 // at evalScript (node:internal/process/execution:76:60) // at node:internal/main/eval_string:23:3 const name = 'Will Robinson'; console.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to stderr ``` Example using the `Console` class: ```js const out = getStreamSomehow(); const err = getStreamSomehow(); const myConsole = new console.Console(out, err); myConsole.log('hello world'); // Prints: hello world, to out myConsole.log('hello %s', 'world'); // Prints: hello world, to out myConsole.error(new Error('Whoops, something bad happened')); // Prints: [Error: Whoops, something bad happened], to err const name = 'Will Robinson'; myConsole.warn(`Danger ${name}! Danger!`); // Prints: Danger Will Robinson! Danger!, to err ```

console
.
(method) Console.log(message?: any, ...optionalParams: any[]): void

Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args)). ```js const count = 5; console.log('count: %d', count); // Prints: count: 5, to stdout console.log('count:', count); // Prints: count: 5, to stdout ``` See [`util.format()`](https://nodejs.org/docs/latest-v22.x/api/util.html#utilformatformat-args) for more information.

log
(yield*
const kv: SchemaStore<{ readonly name: string; readonly age: number; }, never>
kv
.
(property) SchemaStore<{ readonly name: string; readonly age: number; }, never>.get: (key: string) => Effect.Effect<Option<{ readonly name: string; readonly age: number; }>, PlatformError | ParseError, never>

Returns the value of the specified key if it exists.

get
("user1"))
25
// Output: { _id: 'Option', _tag: 'Some', value: { name: 'Alice', age: 30 } }
26
})
27
28
import Effect
Effect
.
const runPromise: <void, PlatformError | ParseError>(effect: Effect.Effect<void, PlatformError | ParseError, never>, options?: { readonly signal?: AbortSignal; } | undefined) => Promise<...>

Runs an `Effect` workflow, returning a `Promise` which resolves with the result of the workflow or rejects with an error.

runPromise
(
const program: Effect.Effect<void, PlatformError | ParseError, KeyValueStore>
program
.
(method) Pipeable.pipe<Effect.Effect<void, PlatformError | ParseError, KeyValueStore>, Effect.Effect<void, PlatformError | ParseError, never>>(this: Effect.Effect<...>, ab: (_: Effect.Effect<...>) => Effect.Effect<...>): Effect.Effect<...> (+21 overloads)
pipe
(
import Effect
Effect
.
const provide: <KeyValueStore, never, never>(layer: Layer<KeyValueStore, never, never>) => <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<...> (+9 overloads)

Splits the context into two parts, providing one part using the specified layer/context/runtime and leaving the remainder `R0`

provide
(
(alias) const layerMemory: Layer<KeyValueStore, never, never> import layerMemory
layerMemory
)))