Package me.ahoo.cosid.segment.grouped
Class GroupedKey
java.lang.Object
me.ahoo.cosid.segment.grouped.GroupedKey
Key used for grouping/sharding of ID segments.
Represents a logical grouping key with an optional TTL for time-based sharding strategies (e.g., daily or monthly buckets).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
NEVER
Sentinel value indicating no grouping.
-
-
Constructor Details
-
GroupedKey
Creates a new GroupedKey.- Parameters:
key- the grouping key (e.g., "2024-01" for monthly)ttlAt- the time-to-live expiration timestamp in seconds
-
-
Method Details
-
getKey
Gets the grouping key.- Returns:
- the key
-
getTtlAt
public long getTtlAt()Gets the TTL expiration timestamp.- Returns:
- TTL timestamp in seconds
- See Also:
-
ttl
public long ttl()Calculates remaining TTL from current time.- Returns:
- remaining TTL in seconds, or 0 if expired
-
equals
-
hashCode
public int hashCode() -
toString
-
forever
Creates a GroupedKey that never expires.- Parameters:
key- the grouping key- Returns:
- a forever GroupedKey
-