sqlite-executor 4.0.4 → 4.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,13 @@
1
1
  /** 基于 Map 插入顺序的 LRU 缓存。 */
2
2
  export declare class LRUCache<T> {
3
- constructor(options?: { maxSize?: number; maxKeyLength?: number });
3
+ /**
4
+ * 创建 LRUCache 实例。
5
+ * @param options 可选项。
6
+ * @param options.maxSize 最大缓存条目数,默认为 100。
7
+ * @param options.maxKeyLength 超长 key 的最大长度,默认为 100。超过该长度的 key 不会被缓存。
8
+ * @param options.maxValueLength 超长 value 的最大长度,默认为 Infinity。超过该长度的 value 不会被缓存。
9
+ */
10
+ constructor(options?: { maxSize?: number; maxKeyLength?: number, maxValueLength?: number });
4
11
 
5
12
  /** 获取缓存值,命中时提升到末尾。未命中或 key 不合法时返回 undefined。 */
6
13
  get(key: string): T | undefined;
@@ -16,6 +16,8 @@ export interface PipelineEngineOptions {
16
16
  maxInflight?: number;
17
17
  /** 任务超时时的回调 */
18
18
  onTaskTimeout?: (task: any) => void;
19
+ /** 任务超时检查的时间间隔,默认 100ms */
20
+ sweepInterval?: number;
19
21
  }
20
22
 
21
23
  /**
@@ -2,7 +2,7 @@
2
2
  * 只读 Worker 连接池。
3
3
  *
4
4
  * 管理多个 TaskWorker 实例,所有 worker 共享同一数据库文件。
5
- * 通过轮询(round-robin)分配读任务,实现读操作的水平扩展。
5
+ * 通过 Least Busy(最小负载)分配读任务,实现读操作的水平扩展。
6
6
  *
7
7
  * 注意:ReaderPool 中的 worker 不初始化 WAL 模式(`initMode: "none"`),
8
8
  * 直接继承数据库文件头中的 journal 模式,避免与 writer 竞争 WAL 初始化锁。
@@ -30,7 +30,7 @@ export class ReaderPool {
30
30
  get pendingStatements(): number;
31
31
 
32
32
  /**
33
- * 分发一个读任务到下一个空闲 Worker(轮询)。
33
+ * 分发一个读任务到负载最小的 Worker(Least Busy)。
34
34
  * @param task - 任务配置对象
35
35
  */
36
36
  enqueue(task: object): void;