Documentation
¶
Overview ¶
Package cache provides caching mechanisms for transaction deduplication and tracking.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DuplicateCache ¶
DuplicateCache tracks duplicate transactions within a time window.
func NewDuplicateCache ¶
func NewDuplicateCache() *DuplicateCache
NewDuplicateCache creates a new DuplicateCache instance.
func (*DuplicateCache) Start ¶
func (d *DuplicateCache) Start()
Start begins the cache background processes.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
Metrics provides Prometheus metrics for cache operations.
func NewMetrics ¶
NewMetrics creates a new Metrics instance.
func NewMetricsWithRegisterer ¶ added in v0.2.0
func NewMetricsWithRegisterer(namespace string, registerer prometheus.Registerer) *Metrics
NewMetricsWithRegisterer creates a new Metrics instance with a custom registerer.
func (*Metrics) SetSharedEvictions ¶
SetSharedEvictions sets the shared evictions metric.
func (*Metrics) SetSharedHits ¶
SetSharedHits sets the shared hits metric.
func (*Metrics) SetSharedInsertions ¶
SetSharedInsertions sets the shared insertions metric.
func (*Metrics) SetSharedMisses ¶
SetSharedMisses sets the shared misses metric.
type SentCache ¶ added in v0.2.0
type SentCache struct {
Transaction *ttlcache.Cache[string, time.Time]
// contains filtered or unexported fields
}
SentCache tracks transactions that have been successfully sent to targets to prevent duplicate forwarding across all source peers
func NewSentCache ¶ added in v0.2.0
func NewSentCache() *SentCache
NewSentCache creates a new sent transaction cache
func NewSentCacheWithRegisterer ¶ added in v0.2.0
func NewSentCacheWithRegisterer(registerer prometheus.Registerer) *SentCache
NewSentCacheWithRegisterer creates a new sent transaction cache with a custom registerer. Pass nil to skip metrics registration (useful for tests).
type SharedCache ¶
type SharedCache struct {
// contains filtered or unexported fields
}
SharedCache provides a shared transaction cache across peers.
func NewSharedCache ¶
func NewSharedCache() *SharedCache
NewSharedCache creates a new SharedCache instance.
func NewSharedCacheWithRegisterer ¶ added in v0.2.0
func NewSharedCacheWithRegisterer(registerer prometheus.Registerer) *SharedCache
NewSharedCacheWithRegisterer creates a new SharedCache instance with a custom registerer. Pass nil to skip metrics registration (useful for tests).
func (*SharedCache) Start ¶
func (d *SharedCache) Start(ctx context.Context) error
Start begins the cache background processes.
func (*SharedCache) Stop ¶ added in v0.2.0
func (d *SharedCache) Stop()
Stop stops the cache background processes.