Documentation ¶
Index ¶
- func ByteCountIEC(b int) string
- func GetCacheKey(key string) (string, string)
- type ByTimestamp
- type Cache
- func (c *Cache) Close()
- func (c *Cache) DeleteFile(file string)
- func (c *Cache) Get(key string) (resp []byte, ok bool)
- func (c *Cache) Set(key string, resp []byte)
- func (c *Cache) StartBackgroundThread()
- func (c *Cache) UpdateCacheLimit(cacheLimit int)
- func (c *Cache) UpdateCacheScanInterval(cacheScanInterval int)
- type KeyPair
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ByteCountIEC ¶
ByteCountIEC returns a human-readable string describing the size of bytes in int
func GetCacheKey ¶ added in v0.2.4
Types ¶
type ByTimestamp ¶
type ByTimestamp []KeyPair
ByTimestamp is a sortable slice of KeyPair based off timestamp
func (ByTimestamp) Len ¶
func (a ByTimestamp) Len() int
func (ByTimestamp) Less ¶
func (a ByTimestamp) Less(i, j int) bool
func (ByTimestamp) Swap ¶
func (a ByTimestamp) Swap(i, j int)
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a struct that represents a cache object
func (*Cache) DeleteFile ¶
DeleteFile takes an absolute path to a file and deletes it
func (*Cache) Set ¶
Set takes a key, hashes it, and saves the `resp` bytearray into the corresponding file
func (*Cache) StartBackgroundThread ¶
func (c *Cache) StartBackgroundThread()
StartBackgroundThread starts a background thread that automatically scans the directory and removes older files when cache exceeds size limits
func (*Cache) UpdateCacheLimit ¶
func (*Cache) UpdateCacheScanInterval ¶
Click to show internal directories.
Click to hide internal directories.