Documentation
¶
Index ¶
- Constants
- type Cache
- func (c *Cache) CleanExpired()
- func (c *Cache) Clear()
- func (c *Cache) Delete(key string)
- func (c *Cache) DeleteByPrefix(prefix string)
- func (c *Cache) Get(key string) (string, bool)
- func (c *Cache) IsStale(key string, ttl time.Duration) bool
- func (c *Cache) Set(key, value string, ttl time.Duration)
Constants ¶
View Source
const ( GitTTL = 2 * time.Second ProcessTTL = 2 * time.Second ConfigTTL = 10 * time.Second WorktreeTTL = 5 * time.Minute // Worktree status rarely changes SpotifyTTL = 3 * time.Second // Fast enough for track changes )
Common TTL constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache provides thread-safe in-memory caching with TTL
func (*Cache) CleanExpired ¶ added in v0.8.0
func (c *Cache) CleanExpired()
CleanExpired removes all expired entries from the cache
func (*Cache) DeleteByPrefix ¶
DeleteByPrefix removes all keys with the given prefix
func (*Cache) Get ¶
Get retrieves a value from the cache Returns the value and true if found and not expired, empty string and false otherwise
Click to show internal directories.
Click to hide internal directories.