cache

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(src Entry) ([]byte, error)

Marshal ...

func ReleaseEntry

func ReleaseEntry(e *Entry)

ReleaseEntry ...

func ReleaseResponse

func ReleaseResponse(r *Response)

ReleaseResponse ...

func Unmarshal

func Unmarshal(dst *Entry, data []byte) error

Unmarshal ...

Types

type Cache

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

Cache ...

func New

func New(cfg Config) (*Cache, error)

New ...

func (*Cache) Del

func (c *Cache) Del(key string) error

Del ...

func (*Cache) DelBytes

func (c *Cache) DelBytes(key []byte) error

DelBytes ...

func (*Cache) Get

func (c *Cache) Get(key string, dst *Entry) error

Get ...

func (*Cache) GetBytes

func (c *Cache) GetBytes(key []byte, dst *Entry) error

GetBytes ...

func (*Cache) Iterator

func (c *Cache) Iterator() *bigcache.EntryInfoIterator

Iterator ...

func (*Cache) Len

func (c *Cache) Len() int

Len ...

func (*Cache) Reset

func (c *Cache) Reset() error

Reset ...

func (*Cache) Set

func (c *Cache) Set(key string, entry Entry) error

Set ...

func (*Cache) SetBytes

func (c *Cache) SetBytes(key []byte, entry Entry) error

SetBytes ...

type Config

type Config struct {
	FileConfig config.Cache

	LogLevel  logger.Level
	LogOutput io.Writer
}

Config ...

type Entry

type Entry struct {
	Responses []Response
}

Entry ...

func AcquireEntry

func AcquireEntry() *Entry

AcquireEntry ...

func (*Entry) DecodeMsg

func (z *Entry) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Entry) DelResponse

func (e *Entry) DelResponse(path []byte)

DelResponse ...

func (*Entry) EncodeMsg

func (z *Entry) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Entry) GetAllResponses

func (e Entry) GetAllResponses() []Response

GetAllResponses ...

func (Entry) GetResponse

func (e Entry) GetResponse(path []byte) *Response

GetResponse ...

func (Entry) HasResponse

func (e Entry) HasResponse(path []byte) bool

HasResponse ...

func (Entry) Len

func (e Entry) Len() int

Len ...

func (*Entry) MarshalMsg

func (z *Entry) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Entry) Msgsize

func (z *Entry) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Entry) Reset

func (e *Entry) Reset()

Reset ...

func (*Entry) SetResponse

func (e *Entry) SetResponse(resp Response)

SetResponse ...

func (*Entry) UnmarshalMsg

func (z *Entry) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Response

type Response struct {
	Path    []byte
	Body    []byte
	Headers []ResponseHeader
}

Response ...

func AcquireResponse

func AcquireResponse() *Response

AcquireResponse ...

func (*Response) DecodeMsg

func (z *Response) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*Response) EncodeMsg

func (z *Response) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*Response) HasHeader

func (r *Response) HasHeader(k, v []byte) bool

HasHeader ...

func (*Response) MarshalMsg

func (z *Response) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*Response) Msgsize

func (z *Response) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Response) Reset

func (r *Response) Reset()

Reset reset response

func (*Response) SetHeader

func (r *Response) SetHeader(k, v []byte)

SetHeader ...

func (*Response) UnmarshalMsg

func (z *Response) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type ResponseHeader

type ResponseHeader struct {
	Key   []byte
	Value []byte
}

ResponseHeader ...

func (*ResponseHeader) DecodeMsg

func (z *ResponseHeader) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (*ResponseHeader) EncodeMsg

func (z *ResponseHeader) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (*ResponseHeader) MarshalMsg

func (z *ResponseHeader) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (*ResponseHeader) Msgsize

func (z *ResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ResponseHeader) UnmarshalMsg

func (z *ResponseHeader) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

Jump to

Keyboard shortcuts

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