Documentation ¶
Index ¶
- func Cacheable[K any, V any](key K, fn func() (V, error), c *SharCache) (V, error)
- func NewRistrettoCacheBackend() (*ristrettoCacheBackend, error)
- type Backend
- type MockBackend
- type MockBackend_Expecter
- type MockBackend_Get_Call
- type MockBackend_Set_Call
- type MockCacheBackend
- type MockCacheBackend_Expecter
- type MockCacheBackend_Get_Call
- func (_c *MockCacheBackend_Get_Call) Return(_a0 interface{}, _a1 bool) *MockCacheBackend_Get_Call
- func (_c *MockCacheBackend_Get_Call) Run(run func(key interface{})) *MockCacheBackend_Get_Call
- func (_c *MockCacheBackend_Get_Call) RunAndReturn(run func(interface{}) (interface{}, bool)) *MockCacheBackend_Get_Call
- type MockCacheBackend_Set_Call
- func (_c *MockCacheBackend_Set_Call) Return(_a0 bool) *MockCacheBackend_Set_Call
- func (_c *MockCacheBackend_Set_Call) Run(run func(key interface{}, value interface{})) *MockCacheBackend_Set_Call
- func (_c *MockCacheBackend_Set_Call) RunAndReturn(run func(interface{}, interface{}) bool) *MockCacheBackend_Set_Call
- type SharCache
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewRistrettoCacheBackend ¶
func NewRistrettoCacheBackend() (*ristrettoCacheBackend, error)
NewRistrettoCacheBackend construct an instance of a ristrettoCacheBackend
Types ¶
type Backend ¶
type Backend interface { Get(key interface{}) (interface{}, bool) Set(key interface{}, value interface{}) bool }
Backend defines interface for a Backend
type MockBackend ¶ added in v1.1.1032
MockBackend is an autogenerated mock type for the Backend type
func NewMockBackend ¶ added in v1.1.1032
func NewMockBackend(t interface { mock.TestingT Cleanup(func()) }) *MockBackend
NewMockBackend creates a new instance of MockBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockBackend) EXPECT ¶ added in v1.1.1032
func (_m *MockBackend) EXPECT() *MockBackend_Expecter
func (*MockBackend) Get ¶ added in v1.1.1032
func (_m *MockBackend) Get(key interface{}) (interface{}, bool)
Get provides a mock function with given fields: key
func (*MockBackend) Set ¶ added in v1.1.1032
func (_m *MockBackend) Set(key interface{}, value interface{}) bool
Set provides a mock function with given fields: key, value
type MockBackend_Expecter ¶ added in v1.1.1032
type MockBackend_Expecter struct {
// contains filtered or unexported fields
}
func (*MockBackend_Expecter) Get ¶ added in v1.1.1032
func (_e *MockBackend_Expecter) Get(key interface{}) *MockBackend_Get_Call
Get is a helper method to define mock.On call
- key interface{}
func (*MockBackend_Expecter) Set ¶ added in v1.1.1032
func (_e *MockBackend_Expecter) Set(key interface{}, value interface{}) *MockBackend_Set_Call
Set is a helper method to define mock.On call
- key interface{}
- value interface{}
type MockBackend_Get_Call ¶ added in v1.1.1032
MockBackend_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
func (*MockBackend_Get_Call) Return ¶ added in v1.1.1032
func (_c *MockBackend_Get_Call) Return(_a0 interface{}, _a1 bool) *MockBackend_Get_Call
func (*MockBackend_Get_Call) Run ¶ added in v1.1.1032
func (_c *MockBackend_Get_Call) Run(run func(key interface{})) *MockBackend_Get_Call
func (*MockBackend_Get_Call) RunAndReturn ¶ added in v1.1.1032
func (_c *MockBackend_Get_Call) RunAndReturn(run func(interface{}) (interface{}, bool)) *MockBackend_Get_Call
type MockBackend_Set_Call ¶ added in v1.1.1032
MockBackend_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
func (*MockBackend_Set_Call) Return ¶ added in v1.1.1032
func (_c *MockBackend_Set_Call) Return(_a0 bool) *MockBackend_Set_Call
func (*MockBackend_Set_Call) Run ¶ added in v1.1.1032
func (_c *MockBackend_Set_Call) Run(run func(key interface{}, value interface{})) *MockBackend_Set_Call
func (*MockBackend_Set_Call) RunAndReturn ¶ added in v1.1.1032
func (_c *MockBackend_Set_Call) RunAndReturn(run func(interface{}, interface{}) bool) *MockBackend_Set_Call
type MockCacheBackend ¶
MockCacheBackend is an autogenerated mock type for the Backend type
func NewMockCacheBackend ¶
func NewMockCacheBackend(t interface { mock.TestingT Cleanup(func()) }) *MockCacheBackend
NewMockCacheBackend creates a new instance of MockCacheBackend. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.
func (*MockCacheBackend) EXPECT ¶
func (_m *MockCacheBackend) EXPECT() *MockCacheBackend_Expecter
func (*MockCacheBackend) Get ¶
func (_m *MockCacheBackend) Get(key interface{}) (interface{}, bool)
Get provides a mock function with given fields: key
func (*MockCacheBackend) Set ¶
func (_m *MockCacheBackend) Set(key interface{}, value interface{}) bool
Set provides a mock function with given fields: key, value
type MockCacheBackend_Expecter ¶
type MockCacheBackend_Expecter struct {
// contains filtered or unexported fields
}
func (*MockCacheBackend_Expecter) Get ¶
func (_e *MockCacheBackend_Expecter) Get(key interface{}) *MockCacheBackend_Get_Call
Get is a helper method to define mock.On call
- key interface{}
func (*MockCacheBackend_Expecter) Set ¶
func (_e *MockCacheBackend_Expecter) Set(key interface{}, value interface{}) *MockCacheBackend_Set_Call
Set is a helper method to define mock.On call
- key interface{}
- value interface{}
type MockCacheBackend_Get_Call ¶
MockCacheBackend_Get_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Get'
func (*MockCacheBackend_Get_Call) Return ¶
func (_c *MockCacheBackend_Get_Call) Return(_a0 interface{}, _a1 bool) *MockCacheBackend_Get_Call
func (*MockCacheBackend_Get_Call) Run ¶
func (_c *MockCacheBackend_Get_Call) Run(run func(key interface{})) *MockCacheBackend_Get_Call
func (*MockCacheBackend_Get_Call) RunAndReturn ¶
func (_c *MockCacheBackend_Get_Call) RunAndReturn(run func(interface{}) (interface{}, bool)) *MockCacheBackend_Get_Call
type MockCacheBackend_Set_Call ¶
MockCacheBackend_Set_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Set'
func (*MockCacheBackend_Set_Call) Return ¶
func (_c *MockCacheBackend_Set_Call) Return(_a0 bool) *MockCacheBackend_Set_Call
func (*MockCacheBackend_Set_Call) Run ¶
func (_c *MockCacheBackend_Set_Call) Run(run func(key interface{}, value interface{})) *MockCacheBackend_Set_Call
func (*MockCacheBackend_Set_Call) RunAndReturn ¶
func (_c *MockCacheBackend_Set_Call) RunAndReturn(run func(interface{}, interface{}) bool) *MockCacheBackend_Set_Call