ForcePilot/backend/package/yuxi/channels/contract/dtos/cache.py
Kris b88c0ae29e feat(channels): 批量新增多渠道网关限界上下文基础代码与契约
新增完整的 channels 限界上下文模块,包含契约层、领域核心层、应用服务、管道编排、插件体系、基础设施组合根等全层级代码,新增飞书与微信 iLink 渠道插件基础结构,补充各类 DTO、端口协议与领域服务实现。
2026-07-02 03:22:12 +08:00

30 lines
806 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""缓存 DTO。
定义缓存端口的值对象,包括锁令牌。所有 DTO 均为
``dataclass(frozen=True)``,仅依赖标准库,用于分布式锁管理。
"""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
@dataclass(frozen=True)
class LockToken:
"""锁令牌。
标识一次分布式锁获取的令牌,携带锁键、令牌值与过期时间,用于锁续期与
释放校验。``key`` 字段使释放操作能从令牌还原锁键,避免适配器维护跨
请求的 ``token -> key`` 映射ADP-023 / INV-5
字段:
key: 锁键(获取时传入,释放时还原)。
value: 令牌值。
expires_at: 过期时间。
"""
key: str
value: str
expires_at: datetime