会话(Session)缓存Config

data class SessionCacheConfig(val ttl: Duration = DEFAULT_TTL, val maxSessions: Int = DEFAULT_MAX_SESSIONS)

Configuration for the read cache of a BufferedSessionService.

The cache assumes this service makes every change to the sessions it caches: until an entry expires, a hit misses changes made elsewhere, such as app: and user: state another instance changed or a session the store deleted. A hit does not wait for buffered writes, so it can show events the store does not hold yet, or never will if their write fails, after which a read goes to the store. The sessions an unfiltered BufferedSessionService.getSession returns share their events and state values with the cache, and a hit can differ from what the store returns, such as in event order, event ids or fields the store does not keep.

构造函数(Constructors)

Link copied to clipboard
constructor(ttl: Duration = DEFAULT_TTL, maxSessions: Int = DEFAULT_MAX_SESSIONS)

类型

Link copied to clipboard
class Builder

Fluent Builder for SessionCacheConfig该功能主要为 Java 语言的调用者提供支持;如果某个属性未被设置,其值将默认使用构造函数中指定的默认值。

Link copied to clipboard
object Companion

属性(Properties)

Link copied to clipboard

一次可以缓存的最大会话数为 1024 个(默认值);如果超过这个限制,系统会删除最近未被访问过的会话。

Link copied to clipboard

会话数据从缓存中读取后,会在缓存中保留多长时间?默认值为 5 分钟。 Duration.INFINITE 禁用过期功能。

函数

Link copied to clipboard

返回一个 Builder 使用该实例的属性进行初始化,主要适用于 Java 调用者。建议优先选择这种方式。 copy 来自 Java 的代码: copy 该函数会按位置获取所有属性的值;因此,每当有新属性被添加时,其函数签名(即函数的定义)就会发生变化。

Link copied to clipboard

返回值 ttl 以毫秒为单位计算(即整个过程耗时多少毫秒)。 Long.MAX_VALUE 如果该值永远不会过期(那么用于获取该值的 Java 方法会被破坏/损坏)。