cache

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: Apache-2.0 Imports: 6 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 struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(maxAge int, pathToDatabase string) (*Cache, error)

NewCache creates a cache layer instance and returns it inner workings like options are not yet available

func (*Cache) AccountNeedUpdate

func (c *Cache) AccountNeedUpdate() (needUpdate bool)

NeedUpdate returns true if cache needs a refresh

func (*Cache) AccountSet

func (c *Cache) AccountSet(account *toggl.Account) error

AccountSet can be used to update the value of the account in the cache

func (*Cache) ClientByID

func (c *Cache) ClientByID(clientID, workspace int) (client *toggl.Client, err error)

func (*Cache) ClientMetaData

func (c *Cache) ClientMetaData(workspace int) (m *MetaData, err error)

ProjectMetaData returns meta data about the projects cache

func (*Cache) Clients

func (c *Cache) Clients(workspace int) (clients []toggl.Client, err error)

func (*Cache) Close

func (c *Cache) Close() error

func (*Cache) GetAccount

func (c *Cache) GetAccount() (acc toggl.Account, err error)

AccountSet can be used to update the value of the account in the cache

func (*Cache) NeedUpdate

func (c *Cache) NeedUpdate(workspace int) bool

NeedUpdate returns true if cache needs a refresh

func (*Cache) ProjectByID

func (c *Cache) ProjectByID(projectID, workspace int) (project *toggl.Project, err error)

func (*Cache) ProjectMetaData

func (c *Cache) ProjectMetaData(workspace int) (m *MetaData, err error)

ProjectMetaData returns meta data about the projects cache

func (*Cache) Projects

func (c *Cache) Projects(workspace int) (projects []toggl.Project, err error)

func (*Cache) SetClients

func (c *Cache) SetClients(workspace int, clients []toggl.Client) error

func (*Cache) SetProjects

func (c *Cache) SetProjects(workspace int, projects []toggl.Project) error

SetProjects stores provided projects in cache

type MetaData

type MetaData struct {
	Updated    time.Time
	NextUpdate time.Time
}

Jump to

Keyboard shortcuts

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