component

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package component provides Redis lifecycle integration for bootstrap.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component() bootstrap.IComponent

Component wraps loadFromEnv as a bootstrap.IComponent. Init calls loadFromEnv; Close closes the default Redis client.

Example

ExampleComponent shows how Component() is used in a bootstrap registration chain. It reads Redis connection parameters from env during Init():

redis.clusters  — comma-separated node addresses
redis.database  — database index (ignored in cluster mode)
redis.password  — authentication password

go-redis creates the client without connecting (lazy dial), so Init() always returns nil. Connectivity errors are discovered on the first real command.

bootstrap.New(envComp.Component(...), logComp.Component()).
    Add(redisComp.Component()).
    Run()
package main

import (
	"fmt"

	redisComp "github.com/phcp-tech/common-library-golang/redis/component"
)

func main() {
	c := redisComp.Component()
	fmt.Println(c != nil)
}
Output:
true

Types

This section is empty.

Jump to

Keyboard shortcuts

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