redis

package
v0.28.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SyncChannelName  = "blocky_sync"
	CacheStorePrefix = "blocky:cache:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheMessage

type CacheMessage struct {
	Key      string
	Response *model.Response
}

CacheChannel message

type Client

type Client struct {
	CacheChannel   chan *CacheMessage
	EnabledChannel chan *EnabledMessage
	// contains filtered or unexported fields
}

Client for redis communication

func New

func New(ctx context.Context, cfg *config.Redis) (*Client, error)

New creates a new redis client

func (*Client) GetRedisCache

func (c *Client) GetRedisCache(ctx context.Context)

GetRedisCache reads the redis cache and publish it to the channel

func (*Client) PublishCache

func (c *Client) PublishCache(key string, message *dns.Msg)

PublishCache publish cache to redis async

func (*Client) PublishEnabled

func (c *Client) PublishEnabled(ctx context.Context, state *EnabledMessage)

type EnabledMessage

type EnabledMessage struct {
	State    bool          `json:"s"`
	Duration time.Duration `json:"d,omitempty"`
	Groups   []string      `json:"g,omitempty"`
}

Jump to

Keyboard shortcuts

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