cache

package
v0.0.0-...-a2dbb6b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 10, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StateInitialized cachedPlcConnectionState = iota
	StateIdle
	StateInUse
	StateInvalid
)

Variables

This section is empty.

Functions

This section is empty.

Types

type PlcConnectionCache

type PlcConnectionCache interface {
	GetConnection(ctx context.Context, connectionString string) (plc4go.PlcConnection, error)
	Close() error
}

func NewPlcConnectionCache

func NewPlcConnectionCache(driverManager plc4go.PlcDriverManager, withConnectionCacheOptions ...WithConnectionCacheOption) PlcConnectionCache

type WithConnectionCacheOption

type WithConnectionCacheOption func(plcConnectionCache *plcConnectionCache)

func WithCustomLogger

func WithCustomLogger(logger zerolog.Logger) WithConnectionCacheOption

func WithLogger deprecated

func WithLogger(logger zerolog.Logger) WithConnectionCacheOption

Deprecated: use WithCustomLogger

func WithMaxIdleTime

func WithMaxIdleTime(maxIdleTime time.Duration) WithConnectionCacheOption

WithMaxIdleTime discards cached connections that sat idle for longer than the given duration and re-establishes them on the next lease (0 = keep forever, the default). Use this against remotes that silently reap idle connections (half-open TCP): such a death is undetectable until the first write fails, so connections past this age are replaced proactively. As a side effect, connection slots on connection-limited remotes are freed between bursts instead of being parked indefinitely.

func WithMaxLeaseTime

func WithMaxLeaseTime(maxLeaseTime time.Duration) WithConnectionCacheOption

func WithMaxWaitTime

func WithMaxWaitTime(maxWaitTime time.Duration) WithConnectionCacheOption

func WithTracer

func WithTracer() WithConnectionCacheOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL