# Class LittleGhost::SessionStores::Memory

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/SessionStores/Memory.html

Memory keeps conversations available for the life of one Ruby process. It is
the default store and needs no application setup.

Data disappears when the process exits. Supplying an actor ID binds the
session key to that actor; a later mismatch raises an error.

## Inheritance

`LittleGhost::SessionStores::Memory < LittleGhost::SessionStore`

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new()
```

Starts with no saved conversations.

## Instance methods

<a id="method-i-append"></a>
### `#append`

```ruby
#append(id, messages:, state:, metadata:, expected_count:, actor_id: nil)
```

Appends sanitized `messages` when `expected_count` still matches the stored
conversation, then returns the updated snapshot.

<a id="method-i-load"></a>
### `#load`

```ruby
#load(id, actor_id: nil)
```

Loads the snapshot for `id`, returning `nil` before the first checkpoint. A
supplied `actor_id` claims a new ID and must match on later access.

<a id="method-i-replace"></a>
### `#replace`

```ruby
#replace(id, messages:, state:, metadata:, actor_id: nil)
```

Replaces the complete in-memory snapshot with sanitized `messages`.
