cache

package
v0.1.0-alpha.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 7, 2026 License: MIT Imports: 8 Imported by: 0

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

func NewFileCacheWithPath(path string) *FileCache

NewFileCacheWithPath creates a FileCache at a specific path (useful for testing).

func (*FileCache) Read

func (c *FileCache) Read() (CachedData, error)

func (*FileCache) Write

func (c *FileCache) Write(sessions model.SeshSessions) error

type MockCache

type MockCache struct {
	mock.Mock
}

MockCache is an autogenerated mock type for the Cache type

func NewMockCache

func NewMockCache(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCache

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

func (*MockCache) Write

func (_m *MockCache) Write(sessions model.SeshSessions) error

Write provides a mock function with given fields: sessions

type MockCache_Expecter

type MockCache_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockCache_Expecter) Read

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

type MockCache_Read_Call struct {
	*mock.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 (*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

type MockCache_Write_Call struct {
	*mock.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 (*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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL