Versions in this module Expand all Collapse all v0 v0.1.1 Jul 22, 2026 Changes in this version type ByteView + func (b ByteView) Bytes() []byte v0.0.3 Jul 19, 2026 v0.0.2 Jul 18, 2026 Changes in this version + var DefaultServerOptions = &ServerOptions + var ErrGroupClosed = errors.New("cache group is closed") + var ErrKeyRequired = errors.New("key is required") + var ErrValueRequired = errors.New("value is required") + func DestroyAllGroups() + func DestroyGroup(name string) bool + func ListGroups() []string + type ByteView struct + func (b ByteView) ByteSlice() []byte + func (b ByteView) Len() int + func (b ByteView) String() string + type Cache struct + func NewCache(opts CacheOptions) *Cache + func (c *Cache) Add(key string, value ByteView) + func (c *Cache) AddWithExpiration(key string, value ByteView, expirationTime time.Time) + func (c *Cache) Clear() + func (c *Cache) Close() + func (c *Cache) Delete(key string) bool + func (c *Cache) Get(ctx context.Context, key string) (value ByteView, ok bool) + func (c *Cache) Len() int + func (c *Cache) Stats() map[string]interface{} + type CacheOptions struct + BucketCount uint16 + CacheType store.CacheType + CapPerBucket uint16 + CleanupTime time.Duration + Level2Cap uint16 + MaxBytes int64 + OnEvicted func(key string, value store.Value) + func DefaultCacheOptions() CacheOptions + type Client struct + func NewClient(addr string, svcName string, etcdCli *clientv3.Client, opts ...ClientOption) (*Client, error) + func (c *Client) Close() error + func (c *Client) Delete(ctx context.Context, group, key string) (bool, error) + func (c *Client) Get(group, key string) ([]byte, error) + func (c *Client) Set(ctx context.Context, group string, key string, value []byte) error + type ClientOption func(*ClientOptions) + func WithClientAuthToken(token string) ClientOption + func WithClientTLS(caCertFile, serverName string, insecureSkipVerify bool) ClientOption + type ClientOptions struct + AuthToken string + CACertFile string + InsecureSkipVerify bool + ServerName string + TLS bool + type ClientPicker struct + func NewClientPicker(addr string, opts ...PickerOption) (*ClientPicker, error) + func (p *ClientPicker) Close() error + func (p *ClientPicker) PickPeer(key string) (Peer, bool, bool) + func (p *ClientPicker) PrintPeers() + type Getter interface + Get func(ctx context.Context, key string) ([]byte, error) + type GetterFunc func(ctx context.Context, key string) ([]byte, error) + func (f GetterFunc) Get(ctx context.Context, key string) ([]byte, error) + type Group struct + func GetGroup(name string) *Group + func NewGroup(name string, cacheBytes int64, getter Getter, opts ...GroupOption) *Group + func (g *Group) Clear() + func (g *Group) Delete(ctx context.Context, key string) error + func (g *Group) Get(ctx context.Context, key string) (ByteView, error) + func (g *Group) Set(ctx context.Context, key string, value []byte) error + func (g *Group) Stats() map[string]interface{} + type GroupOption func(*Group) + func WithCacheOptions(opts CacheOptions) GroupOption + func WithExpiration(d time.Duration) GroupOption + func WithPeers(peers PeerPicker) GroupOption + type Peer interface + Close func() error + Delete func(ctx context.Context, group string, key string) (bool, error) + Get func(group string, key string) ([]byte, error) + Set func(ctx context.Context, group string, key string, value []byte) error + type PeerPicker interface + Close func() error + PickPeer func(key string) (peer Peer, ok bool, self bool) + type PickerOption func(*ClientPicker) + func WithClientOptions(opts ...ClientOption) PickerOption + func WithEtcdEndpointsForClientPicker(endpoints []string) PickerOption + func WithServiceName(name string) PickerOption + type Server struct + func NewServer(addr, svcName string, opts ...ServerOption) (*Server, error) + func (s *Server) Delete(ctx context.Context, req *proto.DeleteRequest) (*proto.DeleteResponse, error) + func (s *Server) Get(ctx context.Context, req *proto.GetRequest) (*proto.GetResponse, error) + func (s *Server) Set(ctx context.Context, req *proto.SetRequest) (*proto.SetResponse, error) + func (s *Server) Start() error + func (s *Server) Stop() + type ServerOption func(*ServerOptions) + func WithAdvertiseAddr(addr string) ServerOption + func WithDialTimeout(timeout time.Duration) ServerOption + func WithEtcdEndpoints(endpoints []string) ServerOption + func WithServerAuthToken(token string) ServerOption + func WithStatsAddr(addr string) ServerOption + func WithTLS(certFile, keyFile string) ServerOption + type ServerOptions struct + AdvertiseAddr string + AuthToken string + CertFile string + DialTimeout time.Duration + EtcdEndpoints []string + KeyFile string + MaxMsgSize int + StatsAddr string + TLS bool