- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for InitOnce (0.31 sec)
-
internal/cachevalue/cache_test.go
defer sl.Stop() select { case <-sl.C: case <-ctx.Done(): return ctx.Err() } return nil } func TestCacheCtx(t *testing.T) { cache := New[time.Time]() t.Parallel() cache.InitOnce(2*time.Second, Opts{}, func(ctx context.Context) (time.Time, error) { return time.Now(), slowCaller(ctx) }, ) ctx, cancel := context.WithCancel(context.Background()) cancel() // cancel context to test.
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Thu May 09 00:51:34 UTC 2024 - 2.7K bytes - Viewed (0) -
internal/cachevalue/cache.go
return &Cache[T]{ ttl: ttl, updateFn: update, opts: opts, } } // InitOnce initializes the cache with a TTL and an update function. It is // guaranteed to be called only once. func (t *Cache[T]) InitOnce(ttl time.Duration, opts Opts, update func(ctx context.Context) (T, error)) { t.Once.Do(func() { t.ttl = ttl t.updateFn = update t.opts = opts })
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri May 24 12:50:46 UTC 2024 - 4.4K bytes - Viewed (0) -
internal/event/target/nsq.go
} if n.QueueDir != "" { if !filepath.IsAbs(n.QueueDir) { return errors.New("queueDir path should be absolute") } } return nil } // NSQTarget - NSQ target. type NSQTarget struct { initOnce once.Init id event.TargetID args NSQArgs producer *nsq.Producer store store.Store[event.Event] config *nsq.Config loggerOnce logger.LogOnce quitCh chan struct{} }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 7.1K bytes - Viewed (0) -
internal/event/target/redis.go
return fmt.Errorf("expected type %v does not match with available type %v", expectedType, typeAvailable) } } return nil } // RedisTarget - Redis target. type RedisTarget struct { initOnce once.Init id event.TargetID args RedisArgs pool *redis.Pool store store.Store[event.Event] firstPing bool loggerOnce logger.LogOnce quitCh chan struct{} }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 9.1K bytes - Viewed (0) -
internal/event/target/webhook.go
return errors.New("cert and key must be specified as a pair") } return nil } // WebhookTarget - Webhook target. type WebhookTarget struct { initOnce once.Init id event.TargetID args WebhookArgs transport *http.Transport httpClient *http.Client store store.Store[event.Event] loggerOnce logger.LogOnce
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 8.8K bytes - Viewed (0) -
internal/event/target/mqtt.go
} if m.QoS == 0 { return errors.New("qos should be set to 1 or 2 if queueDir is set") } } return nil } // MQTTTarget - MQTT target. type MQTTTarget struct { initOnce once.Init id event.TargetID args MQTTArgs client mqtt.Client store store.Store[event.Event] quitCh chan struct{} loggerOnce logger.LogOnce }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 8.2K bytes - Viewed (0) -
cmd/data-usage.go
z, ok := objAPI.(*erasureServerPools) if !ok { // Prefix usage is empty return map[string]uint64{}, nil } cache := dataUsageCache{} prefixUsageCache.InitOnce(30*time.Second, // No need to fail upon Update() error, fallback to old value. cachevalue.Opts{ReturnLastGood: true, NoWait: true}, func(ctx context.Context) (map[string]uint64, error) { m := make(map[string]uint64)
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Thu May 09 00:51:34 UTC 2024 - 5.6K bytes - Viewed (0) -
cmd/bucket-quota.go
return &BucketQuotaSys{} } var bucketStorageCache = cachevalue.New[DataUsageInfo]() // Init initialize bucket quota. func (sys *BucketQuotaSys) Init(objAPI ObjectLayer) { bucketStorageCache.InitOnce(10*time.Second, cachevalue.Opts{ReturnLastGood: true, NoWait: true}, func(ctx context.Context) (DataUsageInfo, error) { if objAPI == nil { return DataUsageInfo{}, errServerNotInitialized }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Thu Aug 15 00:34:56 UTC 2024 - 4.4K bytes - Viewed (0)