Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 446e2af

Browse filesBrowse files
author
Luca Bianconi
committed
style: lint
1 parent 776d66c commit 446e2af
Copy full SHA for 446e2af

File tree

Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-5
lines changed

‎buildcache/build_cache.go

Copy file name to clipboardExpand all lines: buildcache/build_cache.go
+8-5Lines changed: 8 additions & 5 deletions
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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.