Documentation
¶
Index ¶
Constants ¶
View Source
const ( // TTL is the time-to-live for cached items. TTL = 24 * time.Hour // FileLockRetryDelay is the delay between retries when acquiring file locks. FileLockRetryDelay = 100 * time.Millisecond )
Variables ¶
View Source
var ErrNotFound = errors.New("item not found")
ErrNotFound is returned when an item is not found in the cache.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache interface {
// Get retrieves an item from the cache.
Get(ctx context.Context, path string) (*Item, error)
// Put inserts or updates an item in the cache.
Put(ctx context.Context, item *Item) error
}
Cache is the interface for caching file related information.
type Item ¶
type Item struct {
// Path is the absolute path of the file.
Path string `json:"path"`
// ModTime is the last modification time of the file.
ModTime time.Time `json:"mod_time"`
// Size is the size of the file in bytes.
Size int64 `json:"size"`
// Digest is the SHA-256 digest of the file.
Digest string `json:"digest"`
// CreatedAt is the time when the item was created.
CreatedAt time.Time `json:"created_at"`
}
Item represents a cached file item.
Click to show internal directories.
Click to hide internal directories.