Skip to content

Commit 446e2af

Browse files
author
Luca Bianconi
committed
style: lint
1 parent 776d66c commit 446e2af

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Diff for: buildcache/build_cache.go

+8-5
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ import (
2525

2626
const lastUsedFileName = ".last-used"
2727

28-
type buildCache struct {
28+
// BuildCache represents a cache of built files (sketches and cores), it's designed
29+
// to work on directories. Given a directory as "base" it handles direct subdirectories as
30+
// keys
31+
type BuildCache struct {
2932
baseDir *paths.Path
3033
}
3134

3235
// GetOrCreate retrieves or creates the cache directory at the given path
3336
// If the cache already exists the lifetime of the cache is extended.
34-
func (bc *buildCache) GetOrCreate(key string) (*paths.Path, error) {
37+
func (bc *BuildCache) GetOrCreate(key string) (*paths.Path, error) {
3538
keyDir := bc.baseDir.Join(key)
3639
if err := keyDir.MkdirAll(); err != nil {
3740
return nil, err
@@ -46,7 +49,7 @@ func (bc *buildCache) GetOrCreate(key string) (*paths.Path, error) {
4649
// Purge removes all cache directories within baseDir that have expired
4750
// To know how long ago a directory has been last used
4851
// it checks into the .last-used file.
49-
func (bc *buildCache) Purge(ttl time.Duration) {
52+
func (bc *BuildCache) Purge(ttl time.Duration) {
5053
files, err := bc.baseDir.ReadDir()
5154
if err != nil {
5255
return
@@ -59,8 +62,8 @@ func (bc *buildCache) Purge(ttl time.Duration) {
5962
}
6063

6164
// New instantiates a build cache
62-
func New(baseDir *paths.Path) *buildCache {
63-
return &buildCache{baseDir}
65+
func New(baseDir *paths.Path) *BuildCache {
66+
return &BuildCache{baseDir}
6467
}
6568

6669
func removeIfExpired(dir *paths.Path, ttl time.Duration) {

0 commit comments

Comments
 (0)