Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cacher ¶
type Cacher interface {
Get(string, time.Time, func() ([]byte, error)) func() ([]byte, error)
Expire(string) error
}
Cacher defines the interface for a caching system so it can be customised.
type CacherMock ¶ added in v1.0.1
type CacherMock struct {
// ExpireFunc mocks the Expire function.
ExpireFunc func(in1 string) error
// GetFunc mocks the Get function.
GetFunc func(in1 string, in2 time.Time, in3 func() ([]byte, error)) func() ([]byte, error)
}
CacherMock is a mock implementation of Cacher.
func TestSomethingThatUsesCacher(t *testing.T) {
// make and configure a mocked Cacher
mockedCacher := &CacherMock{
ExpireFunc: func(in1 string) error {
panic("TODO: mock out the Expire function")
},
GetFunc: func(in1 string, in2 time.Time, in3 func() ([]byte, error)) func() ([]byte, error) {
panic("TODO: mock out the Get function")
},
}
// TODO: use mockedCacher in code that requires Cacher
}
func (*CacherMock) Expire ¶ added in v1.0.1
func (mock *CacherMock) Expire(in1 string) error
Expire calls ExpireFunc.
Click to show internal directories.
Click to hide internal directories.