aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/cache/cache.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-22 23:06:39 +0100
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-02-22 23:06:39 +0100
commitbf5001fe2b4d5417e4419cc2195754371fcef03c (patch)
tree51903344a24ab7b5bec54dd2a70d82cffa507366 /internal/feed/cache/cache.go
parent7106d5a6e7585dce5fdd552cca30063dd352dc23 (diff)
downloadfeed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.tar.gz
feed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.tar.bz2
feed2imap-go-bf5001fe2b4d5417e4419cc2195754371fcef03c.zip
Improve naming
Diffstat (limited to 'internal/feed/cache/cache.go')
-rw-r--r--internal/feed/cache/cache.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/feed/cache/cache.go b/internal/feed/cache/cache.go
index e7fe673..e69e8f3 100644
--- a/internal/feed/cache/cache.go
+++ b/internal/feed/cache/cache.go
@@ -50,7 +50,7 @@ type CachedFeed interface {
Feed() *feed.Feed
}
-func cacheForVersion(version Version) (Impl, error) {
+func forVersion(version Version) (Impl, error) {
switch version {
case v1Version:
return newV1Cache(), nil
@@ -124,8 +124,8 @@ func (cache *Cache) Unlock() error {
return nil
}
-func newCache() (Cache, error) {
- cache, err := cacheForVersion(currentVersion)
+func create() (Cache, error) {
+ cache, err := forVersion(currentVersion)
if err != nil {
return Cache{}, err
}
@@ -135,12 +135,12 @@ func newCache() (Cache, error) {
}, nil
}
-func LoadCache(fileName string) (Cache, error) {
+func Load(fileName string) (Cache, error) {
f, err := os.Open(fileName)
if err != nil {
if errors.Is(err, os.ErrNotExist) {
// no cache there yet -- make new
- return newCache()
+ return create()
}
return Cache{}, fmt.Errorf("opening cache at '%s': %w", fileName, err)
}
@@ -159,7 +159,7 @@ func LoadCache(fileName string) (Cache, error) {
return Cache{}, fmt.Errorf("reading from '%s': %w", fileName, err)
}
- cache, err := cacheForVersion(Version(version))
+ cache, err := forVersion(Version(version))
if err != nil {
return Cache{}, err
}