FastestMCP.TaskBackend.Memory (fastest_mcp v0.2.0)

Copy Markdown View Source

ETS-backed in-memory task backend.

The default implementation keeps one private ETS table for task bodies and dedicated ordered indexes for listing and expiry:

tasks              -> task_id => task
created_index      -> {-submitted_at, task_id} => session_id
session_created    -> {session_id, -submitted_at, task_id} => true
expiry_index       -> {expires_at, task_id} => true

The important part is not the exact table layout; it is that the runtime can paginate and prune without re-sorting the full task set on every request.

Summary

Functions

Returns a specification to start this module under a supervisor.

Deletes one stored task.

Deletes expired tasks and returns their task ids.

Fetches one stored task.

Lists tasks with cursor pagination.

Stores or replaces one task.

Starts the process owned by this module.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

delete_task(store, task_id)

Deletes one stored task.

expire_tasks(store, now_ms)

Deletes expired tasks and returns their task ids.

fetch_task(store, task_id, opts \\ [])

Fetches one stored task.

list_tasks(store, opts \\ [])

Lists tasks with cursor pagination.

put_task(store, task)

Stores or replaces one task.

start_link(opts \\ [])

Starts the process owned by this module.