Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for NewFromFunc (0.32 sec)

  1. cmd/metrics-v3-cache.go

    }
    
    func newNodesUpDownCache() *cachevalue.Cache[nodesOnline] {
    	loadNodesUpDown := func() (v nodesOnline, err error) {
    		v.Online, v.Offline = globalNotificationSys.GetPeerOnlineCount()
    		return
    	}
    	return cachevalue.NewFromFunc(1*time.Minute,
    		cachevalue.Opts{ReturnLastGood: true},
    		loadNodesUpDown)
    }
    
    type driveIOStatMetrics struct {
    	readsPerSec    float64
    	readsKBPerSec  float64
    	readsAwait     float64
    	writesPerSec   float64
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Wed Apr 17 05:10:25 GMT 2024
    - 7.3K bytes
    - Viewed (0)
  2. internal/cachevalue/cache.go

    // New allocates a new cached value instance. Tt must be initialized with
    // `.TnitOnce`.
    func New[T any]() *Cache[T] {
    	return &Cache[T]{}
    }
    
    // NewFromFunc allocates a new cached value instance and initializes it with an
    // update function, making it ready for use.
    func NewFromFunc[T any](ttl time.Duration, opts Opts, update func() (T, error)) *Cache[T] {
    	return &Cache[T]{
    		ttl:      ttl,
    		updateFn: update,
    		opts:     opts,
    	}
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Mar 01 16:00:42 GMT 2024
    - 4.2K bytes
    - Viewed (0)
  3. cmd/metrics-v2.go

    // RegisterRead register the metrics populator function to be used
    // to populate new values upon cache invalidation.
    func (g *MetricsGroupV2) RegisterRead(read func(context.Context) []MetricV2) {
    	g.metricsCache = cachevalue.NewFromFunc(g.cacheInterval,
    		cachevalue.Opts{ReturnLastGood: true},
    		func() ([]MetricV2, error) {
    			if g.metricsGroupOpts.dependGlobalObjectAPI {
    				objLayer := newObjectLayerFn()
    				// Service not initialized yet
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Apr 11 21:22:15 GMT 2024
    - 132.1K bytes
    - Viewed (0)
Back to top