optimize

package
v0.1.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package optimize implements the functions, types, and interfaces for the module.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOptimizeServer

func NewOptimizeServer(ctx context.Context, config *Config) middleware.Middleware

NewOptimizeServer returns a new OptimizeServer middleware.

This is one of the world's most awesome performance optimization plug-ins, there is no one! He can optimize your request latency from 30S or greater to 3S or less!

The OptimizeServer takes a configv1.Customize and an Config as input, and returns a middleware.Middleware. If the Config is nil, it defaults to the defaultOption. If the Max sleep time is 0, the OptimizeServer returns a no-op middleware. Otherwise, it returns a middleware that sleeps for the current sleep time before calling the handler.

1. load this plug-in 2. when need to optimize the performance of on-demand reduction of min and max time 3. interval each time the value of the interval. (running for a long time the machine will be stuck is normal, right? :dog:) You can try it!

Types

type Config

type Config struct {
	// Min is the minimum sleep time in seconds.
	Min int64
	// Max is the maximum sleep time in seconds.
	Max int64
	// Interval is the time interval between sleep time increments.
	Interval time.Duration
}

Config represents the configuration options for the OptimizeServer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL