Documentation ¶
Overview ¶
Code generated by MockGen. DO NOT EDIT. Source: cache.go
Generated by this command:
mockgen -destination cache_mock.go -source cache.go -package cache
Package cache is a generated GoMock package.
Index ¶
- Constants
- func NewCertifyMutliCache(caches ...certify.Cache) certify.Cache
- type Cache
- type Item
- type MockCache
- func (m *MockCache) Add(k string, x any, d time.Duration) error
- func (m *MockCache) Delete(k string)
- func (m *MockCache) DeleteExpired()
- func (m *MockCache) EXPECT() *MockCacheMockRecorder
- func (m *MockCache) Flush()
- func (m *MockCache) Get(k string) (any, bool)
- func (m *MockCache) GetWithExpiration(k string) (any, time.Time, bool)
- func (m *MockCache) ItemCount() int
- func (m *MockCache) Items() map[string]Item
- func (m *MockCache) Keys() []string
- func (m *MockCache) Load(r io.Reader) error
- func (m *MockCache) LoadFile(fname string) error
- func (m *MockCache) OnEvicted(f func(string, any))
- func (m *MockCache) Save(w io.Writer) error
- func (m *MockCache) SaveFile(fname string) error
- func (m_2 *MockCache) Scan(m string, n int) ([]string, error)
- func (m *MockCache) Set(k string, x any, d time.Duration)
- func (m *MockCache) SetDefault(k string, x any)
- type MockCacheMockRecorder
- func (mr *MockCacheMockRecorder) Add(k, x, d any) *gomock.Call
- func (mr *MockCacheMockRecorder) Delete(k any) *gomock.Call
- func (mr *MockCacheMockRecorder) DeleteExpired() *gomock.Call
- func (mr *MockCacheMockRecorder) Flush() *gomock.Call
- func (mr *MockCacheMockRecorder) Get(k any) *gomock.Call
- func (mr *MockCacheMockRecorder) GetWithExpiration(k any) *gomock.Call
- func (mr *MockCacheMockRecorder) ItemCount() *gomock.Call
- func (mr *MockCacheMockRecorder) Items() *gomock.Call
- func (mr *MockCacheMockRecorder) Keys() *gomock.Call
- func (mr *MockCacheMockRecorder) Load(r any) *gomock.Call
- func (mr *MockCacheMockRecorder) LoadFile(fname any) *gomock.Call
- func (mr *MockCacheMockRecorder) OnEvicted(f any) *gomock.Call
- func (mr *MockCacheMockRecorder) Save(w any) *gomock.Call
- func (mr *MockCacheMockRecorder) SaveFile(fname any) *gomock.Call
- func (mr *MockCacheMockRecorder) Scan(m, n any) *gomock.Call
- func (mr *MockCacheMockRecorder) Set(k, x, d any) *gomock.Call
- func (mr *MockCacheMockRecorder) SetDefault(k, x any) *gomock.Call
Constants ¶
const ( // For use with functions that take an expiration time. NoExpiration time.Duration = -1 // For use with functions that take an expiration time. Equivalent to // passing in the same expiration duration as was given to New() or // NewFrom() when the cache was created (e.g. 5 minutes.) DefaultExpiration time.Duration = 0 // For use with functions that do not clean up. NoCleanup time.Duration = -1 )
const (
// CertifyCacheDirName is dir name of certify cache.
CertifyCacheDirName = "certs"
)
Variables ¶
This section is empty.
Functions ¶
func NewCertifyMutliCache ¶ added in v2.0.6
NewCertifyMutliCache returns a certify.Cache with multiple caches Such as, cache.NewCertifyMutliCache(certify.NewMemCache(), certify.DirCache("certs")) This multiple cache will get certs from mem cache first, then dir cache to avoid read from filesystem every times.
Types ¶
type Cache ¶
type Cache interface { Scan(m string, n int) ([]string, error) Set(k string, x any, d time.Duration) SetDefault(k string, x any) Add(k string, x any, d time.Duration) error Get(k string) (any, bool) GetWithExpiration(k string) (any, time.Time, bool) Delete(k string) DeleteExpired() Keys() []string OnEvicted(f func(string, any)) Save(w io.Writer) (err error) SaveFile(fname string) error Load(r io.Reader) error LoadFile(fname string) error Items() map[string]Item ItemCount() int Flush() }
func New ¶
Return a new cache with a given default expiration duration and cleanup interval. If the expiration duration is less than one (or NoExpiration), the items in the cache never expire (by default), and must be deleted manually. If the cleanup interval is less than one, expired items are not deleted from the cache before calling c.DeleteExpired().
type MockCache ¶ added in v2.1.28
type MockCache struct {
// contains filtered or unexported fields
}
MockCache is a mock of Cache interface.
func NewMockCache ¶ added in v2.1.28
func NewMockCache(ctrl *gomock.Controller) *MockCache
NewMockCache creates a new mock instance.
func (*MockCache) DeleteExpired ¶ added in v2.1.28
func (m *MockCache) DeleteExpired()
DeleteExpired mocks base method.
func (*MockCache) EXPECT ¶ added in v2.1.28
func (m *MockCache) EXPECT() *MockCacheMockRecorder
EXPECT returns an object that allows the caller to indicate expected use.
func (*MockCache) GetWithExpiration ¶ added in v2.1.28
GetWithExpiration mocks base method.
func (*MockCache) SetDefault ¶ added in v2.1.28
SetDefault mocks base method.
type MockCacheMockRecorder ¶ added in v2.1.28
type MockCacheMockRecorder struct {
// contains filtered or unexported fields
}
MockCacheMockRecorder is the mock recorder for MockCache.
func (*MockCacheMockRecorder) Add ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Add(k, x, d any) *gomock.Call
Add indicates an expected call of Add.
func (*MockCacheMockRecorder) Delete ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Delete(k any) *gomock.Call
Delete indicates an expected call of Delete.
func (*MockCacheMockRecorder) DeleteExpired ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) DeleteExpired() *gomock.Call
DeleteExpired indicates an expected call of DeleteExpired.
func (*MockCacheMockRecorder) Flush ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Flush() *gomock.Call
Flush indicates an expected call of Flush.
func (*MockCacheMockRecorder) Get ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Get(k any) *gomock.Call
Get indicates an expected call of Get.
func (*MockCacheMockRecorder) GetWithExpiration ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) GetWithExpiration(k any) *gomock.Call
GetWithExpiration indicates an expected call of GetWithExpiration.
func (*MockCacheMockRecorder) ItemCount ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) ItemCount() *gomock.Call
ItemCount indicates an expected call of ItemCount.
func (*MockCacheMockRecorder) Items ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Items() *gomock.Call
Items indicates an expected call of Items.
func (*MockCacheMockRecorder) Keys ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Keys() *gomock.Call
Keys indicates an expected call of Keys.
func (*MockCacheMockRecorder) Load ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Load(r any) *gomock.Call
Load indicates an expected call of Load.
func (*MockCacheMockRecorder) LoadFile ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) LoadFile(fname any) *gomock.Call
LoadFile indicates an expected call of LoadFile.
func (*MockCacheMockRecorder) OnEvicted ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) OnEvicted(f any) *gomock.Call
OnEvicted indicates an expected call of OnEvicted.
func (*MockCacheMockRecorder) Save ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Save(w any) *gomock.Call
Save indicates an expected call of Save.
func (*MockCacheMockRecorder) SaveFile ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) SaveFile(fname any) *gomock.Call
SaveFile indicates an expected call of SaveFile.
func (*MockCacheMockRecorder) Scan ¶ added in v2.1.32
func (mr *MockCacheMockRecorder) Scan(m, n any) *gomock.Call
Scan indicates an expected call of Scan.
func (*MockCacheMockRecorder) Set ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) Set(k, x, d any) *gomock.Call
Set indicates an expected call of Set.
func (*MockCacheMockRecorder) SetDefault ¶ added in v2.1.28
func (mr *MockCacheMockRecorder) SetDefault(k, x any) *gomock.Call
SetDefault indicates an expected call of SetDefault.