cache

package
v0.0.0-...-009dced Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResponseCache

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

func NewResponseCache

func NewResponseCache() *ResponseCache

func (*ResponseCache) Get

func (c *ResponseCache) Get(key string) ([]byte, bool)

Get retrieves a non-streaming response from the cache.

func (*ResponseCache) GetStream

func (c *ResponseCache) GetStream(key string) (*StreamResponse, bool)

GetStream retrieves a streaming response from the cache.

func (*ResponseCache) Set

func (c *ResponseCache) Set(key string, value []byte)

Set stores a non-streaming response in the cache.

func (*ResponseCache) SetStream

func (c *ResponseCache) SetStream(key string, bufferSize int) *StreamResponse

SetStream initializes a streaming response in the cache.

type StreamResponse

type StreamResponse struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewStreamResponse

func NewStreamResponse(bufferSize int) *StreamResponse

func (*StreamResponse) Close

func (sr *StreamResponse) Close()

func (*StreamResponse) ReadChunks

func (sr *StreamResponse) ReadChunks() <-chan []byte

func (*StreamResponse) WriteChunk

func (sr *StreamResponse) WriteChunk(chunk []byte)

Jump to

Keyboard shortcuts

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