Documentation
¶
Overview ¶
Package cache includes a memory cache for ntfy-alertmanager.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface { Set(ctx context.Context, fingerprint string, status string) error Contains(ctx context.Context, fingerprint string, status string) (bool, error) Cleanup() }
Cache is the interface that describes a cache for ntfy-alertmanager.
func NewCache ¶
NewCache reads the cache configuration cfg and creates the cache.
func NewDisabledCache ¶
NewDisabledCache creates a new disabled cache.
func NewMemoryCache ¶
NewMemoryCache creates a in-memory cache.
type DisabledCache ¶
type DisabledCache struct{}
DisabledCache is the disabled cache.
func (*DisabledCache) Cleanup ¶
func (c *DisabledCache) Cleanup()
Cleanup is an empty function to implement the interface.
func (*DisabledCache) Contains ¶
Contains is an empty function to implement the interface.
type MemoryCache ¶
type MemoryCache struct {
// contains filtered or unexported fields
}
MemoryCache is the in-memory cache.
func (*MemoryCache) Cleanup ¶
func (c *MemoryCache) Cleanup()
Cleanup iterates over all alerts in the cache and removes them, if they are expired.
func (*MemoryCache) Contains ¶
Contains checks if an alert with a given fingerprint is in the cache and if the status matches.
type RedisCache ¶
type RedisCache struct {
// contains filtered or unexported fields
}
RedisCache is the redis cache.
func (*RedisCache) Cleanup ¶
func (c *RedisCache) Cleanup()
Cleanup is an empty function that is simply here to implement the interface. Redis does its own cleanup.
func (*RedisCache) Contains ¶
Contains checks if an alert with a given fingerprint is in the cache and if the status matches.
Source Files
¶
- cache.go
- disabled.go
- memory.go
- redis.go