mirror of
https://github.com/henrygd/beszel.git
synced 2026-03-24 06:26:17 +01:00
refactor: change ExpiryMap.store to be a pointer
This commit is contained in:
@@ -16,7 +16,7 @@ type val[T comparable] struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ExpiryMap[T comparable] struct {
|
type ExpiryMap[T comparable] struct {
|
||||||
store store.Store[string, val[T]]
|
store *store.Store[string, val[T]]
|
||||||
stopChan chan struct{}
|
stopChan chan struct{}
|
||||||
stopOnce sync.Once
|
stopOnce sync.Once
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ type ExpiryMap[T comparable] struct {
|
|||||||
// New creates a new expiry map with custom cleanup interval
|
// New creates a new expiry map with custom cleanup interval
|
||||||
func New[T comparable](cleanupInterval time.Duration) *ExpiryMap[T] {
|
func New[T comparable](cleanupInterval time.Duration) *ExpiryMap[T] {
|
||||||
m := &ExpiryMap[T]{
|
m := &ExpiryMap[T]{
|
||||||
store: *store.New(map[string]val[T]{}),
|
store: store.New(map[string]val[T]{}),
|
||||||
stopChan: make(chan struct{}),
|
stopChan: make(chan struct{}),
|
||||||
}
|
}
|
||||||
go m.startCleaner(cleanupInterval)
|
go m.startCleaner(cleanupInterval)
|
||||||
|
|||||||
Reference in New Issue
Block a user