-
Notifications
You must be signed in to change notification settings - Fork 2
/
cache_mock.go
43 lines (34 loc) · 853 Bytes
/
cache_mock.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package core
import (
"github.com/stretchr/testify/mock"
"time"
)
type MockCache struct {
mock.Mock
}
func NewMockCache() *MockCache {
return &MockCache{}
}
func (m *MockCache) Close() {
m.Called()
}
func (m *MockCache) Set(key string, value interface{}, expiration time.Duration) error {
args := m.Called(key, value, expiration)
return args.Error(0)
}
func (m *MockCache) Get(dest interface{}, key string) error {
args := m.Called(dest, key)
return args.Error(0)
}
func (m *MockCache) Del(key string) error {
args := m.Called(key)
return args.Error(0)
}
func (m *MockCache) SetJSON(key string, value interface{}, expiration time.Duration) error {
args := m.Called(key, value, expiration)
return args.Error(0)
}
func (m *MockCache) GetJSON(dest interface{}, key string) error {
args := m.Called(dest, key)
return args.Error(0)
}