18 lines
357 B
Go
18 lines
357 B
Go
|
package expirable
|
||
|
|
||
|
import (
|
||
|
"time"
|
||
|
|
||
|
"forge.cadoles.com/arcad/edge/pkg/storage/driver/cache/lfu"
|
||
|
)
|
||
|
|
||
|
type Cache[K comparable, V any] struct {
|
||
|
ttl time.Duration
|
||
|
cache *lfu.Cache[K, V]
|
||
|
timestamps *lfu.Map[K, time.Duration]
|
||
|
}
|
||
|
|
||
|
func NewCache[K comparable, V any](cache *lfu.Cache[K, V], ttl time.Duration) *Cache[K, V] {
|
||
|
return &Cache[K, V]{}
|
||
|
}
|