Documentation ¶
Index ¶
- func SortByExpiry(entries []Data)
- func SortByKey(entries []Data)
- func SortByValue(entries []Data)
- type Cache
- func (c Cache) Clean() error
- func (c Cache) Delete() error
- func (c Cache) Dir() string
- func (c Cache) Expiry(key string) time.Time
- func (c Cache) Filename(key string) string
- func (c Cache) Filepath(key string) string
- func (c Cache) Flush() error
- func (c Cache) Get(key string) ([]byte, error)
- func (c Cache) IsExpired(key string) bool
- func (c Cache) List(options ...func([]Data)) ([]Data, error)
- func (c Cache) Read(key string) (Data, error)
- func (c Cache) Remove(key string) error
- func (c Cache) Set(key string, value []byte, duration time.Duration) error
- type Data
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SortByExpiry ¶
func SortByExpiry(entries []Data)
SortByExpiry is a sort function to sort cache entries by expiry time.
func SortByKey ¶
func SortByKey(entries []Data)
SortByKey is a sort function to sort cache entries by key.
func SortByValue ¶
func SortByValue(entries []Data)
SortByValue is a sort function to sort cache entries by value.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a disk cache. It stores entries in a directory on disk.
func (Cache) Filename ¶
Filename returns the filename of a cache entry. TODO: Remove Filename from the public API?
func (Cache) Filepath ¶
Filepath returns the full path of a cache entry. TODO: Remove Filepath from the public API?
func (Cache) Get ¶
Get gets a cache entry from disk and returns the value only. It returns an error if the entry is expired.
func (Cache) Read ¶
Read reads a cache entry from disk and returns all its data. It does not check if the entry is expired.