Documentation
¶
Index ¶
- func NewCacheID() string
- type ApplicationData
- type Cache
- func (c *Cache) AddRepository(name, target string, filters []string, findResult *finders.FindResult, ...) (*RepositoryCacheEntry, bool)
- func (c *Cache) Get(key string) (*RepositoryCacheEntry, bool)
- func (c *Cache) Has(name string) bool
- func (c *Cache) LoadFromFile() error
- func (c *Cache) PurgeExpired()
- func (c *Cache) SaveToFile() error
- func (c *Cache) Set(key string, value *RepositoryCacheEntry) *RepositoryCacheEntry
- func (c *Cache) SetRateLimit(limit int, remaining int, reset time.Time)
- type RateLimit
- type RepositoryCacheEntry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCacheID ¶
func NewCacheID() string
Types ¶
type ApplicationData ¶
type ApplicationData struct { RateLimit RateLimit `json:"rate_limit"` Repositories map[string]*RepositoryCacheEntry `json:"repositories"` }
func (*ApplicationData) GetRepositoryEntryByKey ¶
func (ad *ApplicationData) GetRepositoryEntryByKey(key string, owner *Cache) *RepositoryCacheEntry
func (*ApplicationData) HasRepositoryEntryByKey ¶
func (ad *ApplicationData) HasRepositoryEntryByKey(key string) bool
func (*ApplicationData) SetRepositoryEntryByKey ¶
func (ad *ApplicationData) SetRepositoryEntryByKey(key string, entry *RepositoryCacheEntry, owner *Cache)
type Cache ¶
type Cache struct { Filename string Data ApplicationData Debug bool // contains filtered or unexported fields }
func (*Cache) AddRepository ¶
func (c *Cache) AddRepository(name, target string, filters []string, findResult *finders.FindResult, expiresAt time.Time) (*RepositoryCacheEntry, bool)
func (*Cache) Get ¶
func (c *Cache) Get(key string) (*RepositoryCacheEntry, bool)
Get retrieves an entry from the cache.
func (*Cache) LoadFromFile ¶
func (*Cache) PurgeExpired ¶
func (c *Cache) PurgeExpired()
func (*Cache) SaveToFile ¶
SaveToFile saves the entire cache to a JSON file.
func (*Cache) Set ¶
func (c *Cache) Set(key string, value *RepositoryCacheEntry) *RepositoryCacheEntry
Set adds a new entry to the cache with a TTL.
type RepositoryCacheEntry ¶
type RepositoryCacheEntry struct { ID string `json:"id"` Name string `json:"name"` LastCheckAt time.Time `json:"last_check_at"` LastDownloadAt time.Time `json:"last_download_at"` LastDownloadTag string `json:"last_download_tag"` LastReleaseDate time.Time `json:"last_release_date"` ExpiresAt time.Time `json:"expires_at"` Target string `json:"target"` Filters []string `json:"filters"` Assets []assets.Asset `json:"assets"` FindError error `json:"find_error"` // contains filtered or unexported fields }
func (*RepositoryCacheEntry) Exists ¶
func (rce *RepositoryCacheEntry) Exists() bool
func (*RepositoryCacheEntry) GetOwner ¶
func (rce *RepositoryCacheEntry) GetOwner() *Cache
func (*RepositoryCacheEntry) UpdateCheckedAt ¶
func (rce *RepositoryCacheEntry) UpdateCheckedAt()
func (*RepositoryCacheEntry) UpdateDownloadedAt ¶
func (rce *RepositoryCacheEntry) UpdateDownloadedAt(tag string)
Click to show internal directories.
Click to hide internal directories.