Documentation
¶
Index ¶
- Constants
- func Close(rdb *redis.Client) error
- func Delete(ctx context.Context, rdb *redis.Client, key string) error
- func Get(ctx context.Context, rdb *redis.Client, key string, target interface{}) error
- func Incr(ctx context.Context, rdb *redis.Client, key string) (int64, error)
- func NewRedisClient(cfg *common.RedisConfig) (*redis.Client, error)
- func Set(ctx context.Context, rdb *redis.Client, key string, value interface{}, ...) error
- type ExternalService
- type ExternalServicesConfig
- type HealthCheck
- type MachineSession
- type Service
Constants ¶
View Source
const ( KeyServicePrefix = "service:" // Use a prefix for service keys KeySessionPrefix = "session:" // Use a prefix for session keys )
Variables ¶
This section is empty.
Functions ¶
func Close ¶
func Close(rdb *redis.Client) error
Close closes the Redis client connection pool. It's important to call this function during service shutdown to release resources.
func Get ¶
Get retrieves a value from Redis. It takes the Redis client, context, key, and a target pointer to store the retrieved value (must be a pointer).
func NewRedisClient ¶
func NewRedisClient(cfg *common.RedisConfig) (*redis.Client, error)
NewRedisClient creates a new Redis client instance with connection pooling.
Types ¶
type ExternalService ¶
type ExternalService struct { Host string `json:"host"` Port int `json:"port"` User string `json:"user,omitempty"` // Optional fields for credentials Password string `json:"password,omitempty"` DBName string `json:"dbname,omitempty"` }
ExternalService represents configuration for an external service
type ExternalServicesConfig ¶
type ExternalServicesConfig struct { Registry ExternalService `json:"registry"` Redis ExternalService `json:"redis"` PostgreSQL ExternalService `json:"postgresql"` RabbitMQ ExternalService `json:"rabbitmq"` }
ExternalServicesConfig holds configurations for external services
type HealthCheck ¶
type HealthCheck struct { Endpoint string `json:"endpoint"` Interval string `json:"interval"` Timeout string `json:"timeout"` }
HealthCheck represents a service's health check configuration.
type MachineSession ¶
type MachineSession struct { SessionID uuid.UUID `json:"session_id"` MachineID uuid.UUID `json:"machine_id"` UserID uuid.UUID `json:"user_id"` URL string `json:"url"` Port int `json:"port"` StartedAt time.Time `json:"started_at"` ExpiresAt time.Time `json:"expires_at"` }
MachineSession represents an active machine session
Click to show internal directories.
Click to hide internal directories.