func CleanupInterval(d time.Duration) Option {
	return func(pm *ProviderManager) error {
		pm.cleanupInterval = d
		return nil
	}
}
CleanupInterval sets the time between GC runs.
Defaults to 1h.
package providers
import (
	"context"
	"encoding/binary"
	"fmt"
	"strings"
	"time"
	"github.com/libp2p/go-libp2p-core/peer"
	peerstore "github.com/libp2p/go-libp2p-core/peerstore"
	peerstoreImpl "github.com/libp2p/go-libp2p-peerstore"
	lru "github.com/hashicorp/golang-lru/simplelru"
	ds "github.com/ipfs/go-datastore"
	autobatch "github.com/ipfs/go-datastore/autobatch"
	dsq "github.com/ipfs/go-datastore/query"
	logging "github.com/ipfs/go-log"
	goprocess "github.com/jbenet/goprocess"
	goprocessctx "github.com/jbenet/goprocess/context"
	base32 "github.com/multiformats/go-base32"
)
const ProvidersKeyPrefix = "/providers/"
var ProvideValidity = time.Hour * 24
var defaultCleanupInterval = time.Hour
var lruCacheSize = 256
var batchBufferSize = 256
var log = logging.Logger("providers")
type ProviderStore interface {
	AddProvider(ctx context.Context, key []byte, prov peer.AddrInfo) error
	GetProviders(ctx context.Context, key []byte) ([]peer.AddrInfo, error)
}
type ProviderManager struct {
	self peer.ID
	cache  lru.LRUCache
	pstore peerstore.Peerstore
	dstore *autobatch.Datastore
	newprovs chan *addProv
	getprovs chan *getProv
	proc     goprocess.Process
	cleanupInterval time.Duration
}
var _ ProviderStore = (*ProviderManager)(nil)
type Option func(*ProviderManager) error
func (pm *ProviderManager) applyOptions(opts ...Option) error {
	for i, opt := range opts {
		if err := opt(pm); err != nil {
			return fmt.Errorf("provider manager option %d failed: %s", i, err)
		}
	}
	return nil
}