# -*- coding: utf-8 -*- r"""按时间窗缓存与作业状态接口(**组件接入点:Redis**)。 现在:进程内 `_WIN_CACHE`(按时间窗重算结果)+ `run/ops_job.json`(作业状态)。 目标:同一接口下新增 Redis 实现,支持多实例共享缓存与分布式锁。 P0 只立契约,无实现(默认仍是进程内 + 本地文件)。 """ from __future__ import annotations from abc import ABC, abstractmethod class WindowCache(ABC): @abstractmethod def get(self, kind: str, window_key: str): ... @abstractmethod def put(self, kind: str, window_key: str, value) -> None: ... @abstractmethod def pending(self, kind: str, window_key: str) -> bool: ... class JobState(ABC): @abstractmethod def read(self) -> dict: ... @abstractmethod def write(self, state: dict) -> None: ...