Skip to content

@codesoul-co/hypha-core / modules/execution-cache/runtime

模块用法

用于执行该边界的运行时行为。Runtime 模块公开 1 类、1 接口。

从包入口导入

ts
import {
  ExecutionResultCache,
} from '@codesoul-co/hypha-core';

import type {
  ExecutionResultCacheOptions,
} from '@codesoul-co/hypha-core';

使用要点

  • 1 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 1 个类提供可实例化的运行时实现;构造参数与公开方法在各自条目中完整列出。

公共导出

Symbol种类签名说明
ExecutionResultCachenew ExecutionResultCache(options: ExecutionResultCacheOptions): ExecutionResultCacheConservative Result Cache for deterministic, read-only command executions. It returns an Execution-owned projection and never fabricates a new receipt, mutates a Workspace, or treats a hit as an executed side effect.
ExecutionResultCacheOptions接口interface ExecutionResultCacheOptionsExecution Result Cache Options 接口,共包含 9 个公开字段或方法。

ExecutionResultCache

Conservative Result Cache for deterministic, read-only command executions. It returns an Execution-owned projection and never fabricates a new receipt, mutates a Workspace, or treats a hit as an executed side effect.

声明

text
export declare class ExecutionResultCache {
    constructor(options: ExecutionResultCacheOptions);
    lookup(rawInput: ExecutionCacheLookupInput): Promise<ExecutionCacheLookupResult>;
    write(rawInput: ExecutionCacheWriteInput): Promise<boolean>;
    invalidate(rawInput: ExecutionCacheLookupInput): Promise<boolean>;
    close(): Promise<void>;
}

公开成员

成员种类签名说明
close方法close(): Promise<void>公开方法;参数与返回类型以签名列为准。
constructor构造函数(options: ExecutionResultCacheOptions): ExecutionResultCache创建该类的实例。
invalidate方法invalidate(rawInput: ExecutionCacheLookupInput): Promise<boolean>公开方法;参数与返回类型以签名列为准。
lookup方法lookup(rawInput: ExecutionCacheLookupInput): Promise<ExecutionCacheLookupResult>公开方法;参数与返回类型以签名列为准。
write方法write(rawInput: ExecutionCacheWriteInput): Promise<boolean>公开方法;参数与返回类型以签名列为准。

ExecutionResultCacheOptions

Execution Result Cache Options 接口,共包含 9 个公开字段或方法。

声明

text
export interface ExecutionResultCacheOptions {
    store: ExecutionCacheStore;
    hasher: ExecutionFingerprintHasher;
    artifactVerifier?: ExecutionCacheArtifactVerifier;
    failureMode?: ExecutionCacheFailureMode;
    operationTimeoutMs?: number;
    ttlMs?: number;
    maxEntryBytes?: number;
    now?: () => number;
    trace?: (event: ExecutionCacheEvent) => Promise<void> | void;
}

契约成员

成员种类签名说明
artifactVerifier属性artifactVerifier?: ExecutionCacheArtifactVerifier公开属性;类型、只读和可选状态以签名列为准。
failureMode属性failureMode?: ExecutionCacheFailureMode公开属性;类型、只读和可选状态以签名列为准。
hasher属性hasher: ExecutionFingerprintHasher公开属性;类型、只读和可选状态以签名列为准。
maxEntryBytes属性maxEntryBytes?: number公开属性;类型、只读和可选状态以签名列为准。
now方法now?(): number公开方法;参数与返回类型以签名列为准。
operationTimeoutMs属性operationTimeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。
store属性store: ExecutionCacheStore公开属性;类型、只读和可选状态以签名列为准。
trace方法trace?(event: ExecutionCacheEvent): Promise<void> | void公开方法;参数与返回类型以签名列为准。
ttlMs属性ttlMs?: number公开属性;类型、只读和可选状态以签名列为准。