@@ -4,6 +4,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/valkey-io/valkey-go"
|
||||
"golang.org/x/sync/semaphore"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
@@ -15,12 +16,14 @@ type Options struct {
|
||||
type Service struct {
|
||||
fs fileSystem
|
||||
cache valkey.Client
|
||||
seph *semaphore.Weighted
|
||||
}
|
||||
|
||||
func New(fs fileSystem, cache valkey.Client) *Service {
|
||||
func New(fs fileSystem, cache valkey.Client, maxConcurency int64) *Service {
|
||||
return &Service{
|
||||
fs: fs,
|
||||
cache: cache,
|
||||
seph: semaphore.NewWeighted(maxConcurency),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user