Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
Read() (CachedData, error)
Write(sessions model.SeshSessions) error
}
Cache reads and writes session data to a persistent store.
type CachedData ¶
type CachedData struct {
Sessions model.SeshSessions
Timestamp time.Time
}
CachedData holds cached sessions along with the time they were written.
type FileCache ¶
type FileCache struct {
// contains filtered or unexported fields
}
FileCache implements Cache using a gob-encoded file under the XDG cache directory.
func NewFileCache ¶
func NewFileCache() *FileCache
NewFileCache creates a FileCache that stores data at $XDG_CACHE_HOME/zeshion/sessions.gob (falling back to ~/.cache/zeshion/sessions.gob).
func NewFileCacheWithPath ¶
NewFileCacheWithPath creates a FileCache at a specific path (useful for testing).
func (*FileCache) Read ¶
func (c *FileCache) Read() (CachedData, error)
type MockCache ¶
MockCache is an autogenerated mock type for the Cache type
func NewMockCache ¶
NewMockCache creates a new instance of MockCache. 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 (*MockCache) EXPECT ¶
func (_m *MockCache) EXPECT() *MockCache_Expecter
func (*MockCache) Read ¶
func (_m *MockCache) Read() (CachedData, error)
Read provides a mock function with no fields
type MockCache_Expecter ¶
type MockCache_Expecter struct {
// contains filtered or unexported fields
}
func (*MockCache_Expecter) Read ¶
func (_e *MockCache_Expecter) Read() *MockCache_Read_Call
Read is a helper method to define mock.On call
func (*MockCache_Expecter) Write ¶
func (_e *MockCache_Expecter) Write(sessions interface{}) *MockCache_Write_Call
Write is a helper method to define mock.On call
- sessions model.SeshSessions
type MockCache_Read_Call ¶
MockCache_Read_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Read'
func (*MockCache_Read_Call) Return ¶
func (_c *MockCache_Read_Call) Return(_a0 CachedData, _a1 error) *MockCache_Read_Call
func (*MockCache_Read_Call) Run ¶
func (_c *MockCache_Read_Call) Run(run func()) *MockCache_Read_Call
func (*MockCache_Read_Call) RunAndReturn ¶
func (_c *MockCache_Read_Call) RunAndReturn(run func() (CachedData, error)) *MockCache_Read_Call
type MockCache_Write_Call ¶
MockCache_Write_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Write'
func (*MockCache_Write_Call) Return ¶
func (_c *MockCache_Write_Call) Return(_a0 error) *MockCache_Write_Call
func (*MockCache_Write_Call) Run ¶
func (_c *MockCache_Write_Call) Run(run func(sessions model.SeshSessions)) *MockCache_Write_Call
func (*MockCache_Write_Call) RunAndReturn ¶
func (_c *MockCache_Write_Call) RunAndReturn(run func(model.SeshSessions) error) *MockCache_Write_Call