diff --git a/cache/metadata.go b/cache/metadata.go index 787b5a5b..d604d935 100644 --- a/cache/metadata.go +++ b/cache/metadata.go @@ -185,22 +185,24 @@ func getLastUsed(si *metadata.StorageItem) (int, *time.Time) { return usageCount, &tm } -func updateLastUsed(si *metadata.StorageItem) error { - count, _ := getLastUsed(si) - count++ - - v, err := metadata.NewValue(count) - if err != nil { - return errors.Wrap(err, "failed to create usageCount value") - } - v2, err := metadata.NewValue(time.Now().UnixNano()) - if err != nil { - return errors.Wrap(err, "failed to create lastUsedAt value") - } - return si.Update(func(b *bolt.Bucket) error { - if err := si.SetValue(b, keyUsageCount, v); err != nil { - return err - } - return si.SetValue(b, keyLastUsedAt, v2) - }) -} +// TODO: temporarily removed until there is an implementation that can do this +// on background or one that doesn't get new refs for every operation +// func updateLastUsed(si *metadata.StorageItem) error { +// count, _ := getLastUsed(si) +// count++ +// +// v, err := metadata.NewValue(count) +// if err != nil { +// return errors.Wrap(err, "failed to create usageCount value") +// } +// v2, err := metadata.NewValue(time.Now().UnixNano()) +// if err != nil { +// return errors.Wrap(err, "failed to create lastUsedAt value") +// } +// return si.Update(func(b *bolt.Bucket) error { +// if err := si.SetValue(b, keyUsageCount, v); err != nil { +// return err +// } +// return si.SetValue(b, keyLastUsedAt, v2) +// }) +// } diff --git a/cache/refs.go b/cache/refs.go index 5a023f04..9be689eb 100644 --- a/cache/refs.go +++ b/cache/refs.go @@ -204,7 +204,7 @@ func (sr *immutableRef) Release(ctx context.Context) error { } func (sr *immutableRef) release(ctx context.Context) error { - updateLastUsed(sr.md) + // updateLastUsed(sr.md) delete(sr.refs, sr) @@ -325,7 +325,7 @@ func (sr *mutableRef) Release(ctx context.Context) error { func (sr *mutableRef) release(ctx context.Context) error { delete(sr.refs, sr) - updateLastUsed(sr.md) + // updateLastUsed(sr.md) if getCachePolicy(sr.md) != cachePolicyRetain { if sr.equalImmutable != nil { if getCachePolicy(sr.equalImmutable.md) == cachePolicyRetain {