Versions in this module Expand all Collapse all v4 v4.1.8 Oct 4, 2024 Changes in this version + const CacheType + const ChainType + const LoadableType + const MetricType + type Cache struct + func New[T any](store store.StoreInterface) *Cache[T] + func (c *Cache[T]) Clear(ctx context.Context) error + func (c *Cache[T]) Delete(ctx context.Context, key any) error + func (c *Cache[T]) Get(ctx context.Context, key any) (T, error) + func (c *Cache[T]) GetCodec() codec.CodecInterface + func (c *Cache[T]) GetType() string + func (c *Cache[T]) GetWithTTL(ctx context.Context, key any) (T, time.Duration, error) + func (c *Cache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (c *Cache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type CacheInterface interface + Clear func(ctx context.Context) error + Delete func(ctx context.Context, key any) error + Get func(ctx context.Context, key any) (T, error) + GetType func() string + Invalidate func(ctx context.Context, options ...store.InvalidateOption) error + Set func(ctx context.Context, key any, object T, options ...store.Option) error + type CacheKeyGenerator interface + GetCacheKey func() string + type ChainCache struct + func NewChain[T any](caches ...SetterCacheInterface[T]) *ChainCache[T] + func (c *ChainCache[T]) Clear(ctx context.Context) error + func (c *ChainCache[T]) Delete(ctx context.Context, key any) error + func (c *ChainCache[T]) Get(ctx context.Context, key any) (T, error) + func (c *ChainCache[T]) GetCaches() []SetterCacheInterface[T] + func (c *ChainCache[T]) GetType() string + func (c *ChainCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (c *ChainCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type LoadFunction func(ctx context.Context, key any) (T, error) + type LoadableCache struct + func NewLoadable[T any](loadFunc LoadFunction[T], cache CacheInterface[T]) *LoadableCache[T] + func (c *LoadableCache[T]) Clear(ctx context.Context) error + func (c *LoadableCache[T]) Close() error + func (c *LoadableCache[T]) Delete(ctx context.Context, key any) error + func (c *LoadableCache[T]) Get(ctx context.Context, key any) (T, error) + func (c *LoadableCache[T]) GetType() string + func (c *LoadableCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (c *LoadableCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type MetricCache struct + func NewMetric[T any](metrics metrics.MetricsInterface, cache CacheInterface[T]) *MetricCache[T] + func (c *MetricCache[T]) Clear(ctx context.Context) error + func (c *MetricCache[T]) Delete(ctx context.Context, key any) error + func (c *MetricCache[T]) Get(ctx context.Context, key any) (T, error) + func (c *MetricCache[T]) GetType() string + func (c *MetricCache[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (c *MetricCache[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type MockCacheInterface struct + func NewMockCacheInterface[T any](ctrl *gomock.Controller) *MockCacheInterface[T] + func (m *MockCacheInterface[T]) Clear(ctx context.Context) error + func (m *MockCacheInterface[T]) Delete(ctx context.Context, key any) error + func (m *MockCacheInterface[T]) EXPECT() *MockCacheInterfaceMockRecorder[T] + func (m *MockCacheInterface[T]) Get(ctx context.Context, key any) (T, error) + func (m *MockCacheInterface[T]) GetType() string + func (m *MockCacheInterface[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (m *MockCacheInterface[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type MockCacheInterfaceMockRecorder struct + func (mr *MockCacheInterfaceMockRecorder[T]) Clear(ctx interface{}) *gomock.Call + func (mr *MockCacheInterfaceMockRecorder[T]) Delete(ctx, key interface{}) *gomock.Call + func (mr *MockCacheInterfaceMockRecorder[T]) Get(ctx, key interface{}) *gomock.Call + func (mr *MockCacheInterfaceMockRecorder[T]) GetType() *gomock.Call + func (mr *MockCacheInterfaceMockRecorder[T]) Invalidate(ctx interface{}, options ...interface{}) *gomock.Call + func (mr *MockCacheInterfaceMockRecorder[T]) Set(ctx, key, object interface{}, options ...interface{}) *gomock.Call + type MockCacheKeyGenerator struct + func NewMockCacheKeyGenerator(ctrl *gomock.Controller) *MockCacheKeyGenerator + func (m *MockCacheKeyGenerator) EXPECT() *MockCacheKeyGeneratorMockRecorder + func (m *MockCacheKeyGenerator) GetCacheKey() string + type MockCacheKeyGeneratorMockRecorder struct + func (mr *MockCacheKeyGeneratorMockRecorder) GetCacheKey() *gomock.Call + type MockSetterCacheInterface struct + func NewMockSetterCacheInterface[T any](ctrl *gomock.Controller) *MockSetterCacheInterface[T] + func (m *MockSetterCacheInterface[T]) Clear(ctx context.Context) error + func (m *MockSetterCacheInterface[T]) Delete(ctx context.Context, key any) error + func (m *MockSetterCacheInterface[T]) EXPECT() *MockSetterCacheInterfaceMockRecorder[T] + func (m *MockSetterCacheInterface[T]) Get(ctx context.Context, key any) (T, error) + func (m *MockSetterCacheInterface[T]) GetCodec() codec.CodecInterface + func (m *MockSetterCacheInterface[T]) GetType() string + func (m *MockSetterCacheInterface[T]) GetWithTTL(ctx context.Context, key any) (T, time.Duration, error) + func (m *MockSetterCacheInterface[T]) Invalidate(ctx context.Context, options ...store.InvalidateOption) error + func (m *MockSetterCacheInterface[T]) Set(ctx context.Context, key any, object T, options ...store.Option) error + type MockSetterCacheInterfaceMockRecorder struct + func (mr *MockSetterCacheInterfaceMockRecorder[T]) Clear(ctx interface{}) *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) Delete(ctx, key interface{}) *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) Get(ctx, key interface{}) *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) GetCodec() *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) GetType() *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) GetWithTTL(ctx, key interface{}) *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) Invalidate(ctx interface{}, options ...interface{}) *gomock.Call + func (mr *MockSetterCacheInterfaceMockRecorder[T]) Set(ctx, key, object interface{}, options ...interface{}) *gomock.Call + type SetterCacheInterface interface + Clear func(ctx context.Context) error + Delete func(ctx context.Context, key any) error + Get func(ctx context.Context, key any) (T, error) + GetCodec func() codec.CodecInterface + GetType func() string + GetWithTTL func(ctx context.Context, key any) (T, time.Duration, error) + Invalidate func(ctx context.Context, options ...store.InvalidateOption) error + Set func(ctx context.Context, key any, object T, options ...store.Option) error