calcserver

package
v0.0.0-...-73149a0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caching

type Caching interface {
	Get(string) (float64, bool)
	SetOrUpdate(string, float64) (bool, error)
}

type CalcCache

type CalcCache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache() *CalcCache

Create cache instance

func (*CalcCache) Get

func (cc *CalcCache) Get(key string) (float64, bool)

Get from cache

func (*CalcCache) SetOrUpdate

func (cc *CalcCache) SetOrUpdate(key string, val float64) (bool, error)

Set or update cache

type CalcOperation

type CalcOperation string

Calculation operation

type CalcResult

type CalcResult struct {
	Action CalcOperation `json:"action"`
	Answer float64       `json:"answer"`
	X      float64       `json:"x"`
	Y      float64       `json:"y"`
	Cached bool          `json:"cached"`
}

Result of calculation

type CalcServer

type CalcServer struct {
	// contains filtered or unexported fields
}

CalcServer contains logic for the server

func Create

func Create() *CalcServer

Create returns new CalcServer instance

func (*CalcServer) ServeHTTP

func (srv *CalcServer) ServeHTTP(w http.ResponseWriter, req *http.Request)

Handler interface for HTTP server

Jump to

Keyboard shortcuts

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