core

package
v0.0.0-...-542f8df Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package core @Author Bing @Date 2023/10/27 17:46:00 @Desc

Package core @Author Bing @Date 2023/10/24 11:07:00 @Desc global cache group for get cache callback cache

Package core @Author Bing @Date 2023/10/25 10:38:00 @Desc

Package core @Author Bing @Date 2023/10/20 16:37:00 @Desc

Package core @Author Bing @Date 2023/11/1 15:30:00 @Desc

Package core @Author Bing @Date 2023/11/2 9:48:00 @Desc

Package core @Author Bing @Date 2023/11/6 11:19:00 @Desc

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Groups map[string]*Group
	// contains filtered or unexported fields
}

func NewGroup

func NewGroup(size int, name string, f callback) *Group

func (*Group) Get

func (g *Group) Get(k string) (any, bool)

func (*Group) GetGroup

func (g *Group) GetGroup(name string) (*Group, bool)

func (*Group) SetGroup

func (g *Group) SetGroup(size int, name string, f callback) (*Group, bool)

type Hash

type Hash func(data []byte) uint32

type Http

type Http struct {
	*Remote
	*Group
	*Map
	*SingleFlight
	// contains filtered or unexported fields
}

func NewHttp

func NewHttp(group *Group, remote *Remote, hashMap *Map, sf *SingleFlight, url, basePath string, api bool) *Http

func (*Http) JSON

func (h *Http) JSON(obj utils.H)

func (*Http) Log

func (h *Http) Log(f string, v ...any)

func (*Http) ServeHTTP

func (h *Http) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Http) SetHeader

func (h *Http) SetHeader(k, v string)

type Lru

type Lru[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewLru

func NewLru[K comparable, V any](len int) *Lru[K, V]

func (*Lru[K, V]) Add

func (l *Lru[K, V]) Add(k K, v V) bool

func (*Lru[K, V]) Get

func (l *Lru[K, V]) Get(k K) (V, bool)

func (*Lru[K, V]) Peek

func (l *Lru[K, V]) Peek(k K) (V, bool)

func (*Lru[K, V]) Range

func (l *Lru[K, V]) Range(f func(k, v any) bool)

func (*Lru[K, V]) Set

func (l *Lru[K, V]) Set(k K, v V)

type Map

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

func NewMap

func NewMap(replicas int, hash Hash) *Map

func (*Map) Add

func (m *Map) Add(keys ...string)

func (*Map) Get

func (m *Map) Get(key string) string

type Node

type Node struct {
	*Remote
	*Group
	*Http
	*Map
	// contains filtered or unexported fields
}

func NewNode

func NewNode(host, port string, api bool, remoteNodeUrl []string, callback callback, basePath string) *Node

func (*Node) Run

func (n *Node) Run()

type Remote

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

type SingleFlight

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

func NewSingleFlight

func NewSingleFlight() *SingleFlight

Jump to

Keyboard shortcuts

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