mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 01:23:49 +00:00
improve and simplify repository caching
This commit is contained in:
10
cache/cache.go
vendored
10
cache/cache.go
vendored
@@ -1,5 +1,7 @@
|
||||
package cache
|
||||
|
||||
//go:generate mockery -name Cache -output mock -case=underscore
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
@@ -23,7 +25,7 @@ func Set(c context.Context, key string, value interface{}) error {
|
||||
// Default creates an in-memory cache with the default
|
||||
// 30 minute expiration period.
|
||||
func Default() Cache {
|
||||
return cache.NewMemoryWithTTL(time.Minute * 30)
|
||||
return NewTTL(time.Minute * 30)
|
||||
}
|
||||
|
||||
// NewTTL returns an in-memory cache with the specified
|
||||
@@ -31,9 +33,3 @@ func Default() Cache {
|
||||
func NewTTL(t time.Duration) Cache {
|
||||
return cache.NewMemoryWithTTL(t)
|
||||
}
|
||||
|
||||
// NewTTL returns an in-memory cache with the specified
|
||||
// ttl expiration period.
|
||||
func NewLRU(size int) Cache {
|
||||
return cache.NewLRU(size)
|
||||
}
|
||||
|
Reference in New Issue
Block a user