cache

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultCleanupInterval defines the cache cleanup frequency
	DefaultCleanupInterval = 10 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IPCache

type IPCache struct {
	// contains filtered or unexported fields
}

IPCache manages a thread-safe cache of IP information with TTL

func NewIPCache

func NewIPCache(ttl time.Duration) *IPCache

NewIPCache creates a new cache with a given TTL

func (*IPCache) Delete

func (c *IPCache) Delete(ip string)

Delete removes an entry from the cache

func (*IPCache) Get

func (c *IPCache) Get(ip string) (*domain.IPInfo, bool)

Get retrieves an entry from the cache if it exists and is not expired

func (*IPCache) MarkBlocked

func (c *IPCache) MarkBlocked(ip string)

MarkBlocked marks an IP as blocked in the firewall

func (*IPCache) Set

func (c *IPCache) Set(info *domain.IPInfo)

Set adds or updates an entry in the cache

Jump to

Keyboard shortcuts

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