package
0.0.11
Repository: https://github.com/dep2p/dsn.git
Documentation: pkg.go.dev

# Functions

NewTimeCache 创建一个默认的 ("first seen") 缓存实现 参数: - ttl: 条目的存活时间 返回值: - TimeCache: 一个实现了 TimeCache 接口的缓存实例.
NewTimeCacheWithStrategy 根据指定的策略创建一个 TimeCache 实例 参数: - strategy: 使用的过期策略 - ttl: 条目的存活时间 返回值: - TimeCache: 一个实现了 TimeCache 接口的缓存实例.

# Constants

Strategy_FirstSeen 表示从添加条目时开始计算过期时间.
Strategy_LastSeen 表示从上次添加或检查条目时开始计算过期时间.

# Structs

FirstSeenCache 是一个时间缓存,仅在消息首次添加时标记其过期时间。.
LastSeenCache 是一个时间缓存,在添加或检查消息存在时,延长其过期时间。.

# Interfaces

TimeCache 是一个最近看到的消息(通过 id)的缓存接口.

# Type aliases

Strategy 表示 TimeCache 过期策略.