cache

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStopped = errors.New("cache channel stopped")

Functions

This section is empty.

Types

type Cache

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

func New

func New[K comparable, V any](ctx context.Context, name string, publish bool) *Cache[K, V]

func (*Cache[K, V]) AddOrUpdate

func (c *Cache[K, V]) AddOrUpdate(k K, v V) error

func (*Cache[K, V]) Close

func (c *Cache[K, V]) Close() error

func (*Cache[K, V]) Delete

func (c *Cache[K, V]) Delete(k K) error

func (*Cache[K, V]) Get

func (c *Cache[K, V]) Get(k K) (V, bool)

func (*Cache[K, V]) Name

func (c *Cache[K, V]) Name() string

func (*Cache[K, V]) Subscribe

func (c *Cache[K, V]) Subscribe() (*broadcaster.Listener[*event.Event], error)

func (*Cache[K, V]) Unsubscribe

func (c *Cache[K, V]) Unsubscribe(l *broadcaster.Listener[*event.Event]) error

func (*Cache[K, V]) Update

func (c *Cache[K, V]) Update(k K, v V) error

type Client

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

func NewClient

func NewClient(ctx context.Context, addr string, d service.GrpcDialer) (*Client, error)

func (*Client) Close

func (c *Client) Close() error

func (*Client) ListenerForEvents

func (c *Client) ListenerForEvents(ctx context.Context) (*broadcaster.Listener[*event.Event], error)

type Service

type Service struct {
	grpc.Container
}

func NewService

func NewService[K comparable, V any](ctx context.Context, cache *Cache[K, V], ops ...Setter) (*Service, error)

func (*Service) Dispose

func (s *Service) Dispose()

func (*Service) Serve

func (s *Service) Serve() (err error)

type Setter

type Setter func(*Service)

func WithGrpcConn

func WithGrpcConn(g service.GrpcConn) Setter

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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