mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-29 07:00:31 +03:00
Make the cache eviction logic for stale entities more robust
Fixes #12458
This commit is contained in:
parent
68e95327f7
commit
503d20954f
12 changed files with 157 additions and 55 deletions
12
cache/dynacache/dynacache_test.go
vendored
12
cache/dynacache/dynacache_test.go
vendored
|
@ -29,12 +29,12 @@ var (
|
|||
)
|
||||
|
||||
type testItem struct {
|
||||
name string
|
||||
isStale bool
|
||||
name string
|
||||
staleVersion uint32
|
||||
}
|
||||
|
||||
func (t testItem) IsStale() bool {
|
||||
return t.isStale
|
||||
func (t testItem) StaleVersion() uint32 {
|
||||
return t.staleVersion
|
||||
}
|
||||
|
||||
func (t testItem) IdentifierBase() string {
|
||||
|
@ -109,7 +109,7 @@ func newTestCache(t *testing.T) *Cache {
|
|||
|
||||
p2.GetOrCreate("clearBecauseStale", func(string) (testItem, error) {
|
||||
return testItem{
|
||||
isStale: true,
|
||||
staleVersion: 32,
|
||||
}, nil
|
||||
})
|
||||
|
||||
|
@ -121,7 +121,7 @@ func newTestCache(t *testing.T) *Cache {
|
|||
|
||||
p2.GetOrCreate("clearNever", func(string) (testItem, error) {
|
||||
return testItem{
|
||||
isStale: false,
|
||||
staleVersion: 0,
|
||||
}, nil
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue