mirror of
https://github.com/TwiN/gatus.git
synced 2025-01-08 23:18:56 +01:00
Update TwinProduction/gocache to v1.2.3
This commit is contained in:
parent
0560b98de4
commit
d03271d128
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.16
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
cloud.google.com/go v0.74.0 // indirect
|
cloud.google.com/go v0.74.0 // indirect
|
||||||
github.com/TwinProduction/gocache v1.2.2
|
github.com/TwinProduction/gocache v1.2.3
|
||||||
github.com/TwinProduction/health v1.0.0
|
github.com/TwinProduction/health v1.0.0
|
||||||
github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663
|
github.com/go-ping/ping v0.0.0-20201115131931-3300c582a663
|
||||||
github.com/google/gofuzz v1.2.0 // indirect
|
github.com/google/gofuzz v1.2.0 // indirect
|
||||||
|
4
go.sum
4
go.sum
@ -49,8 +49,8 @@ github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
|
|||||||
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||||
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
|
||||||
github.com/TwinProduction/gocache v1.2.2 h1:GpIq4HW+oLFlxO8mXapWKx54qT8p7SMWh2tf91jkLDU=
|
github.com/TwinProduction/gocache v1.2.3 h1:4wFNih4CemUX+A99Gk/EsaU0SXSNZV42Ve77v7/7ToY=
|
||||||
github.com/TwinProduction/gocache v1.2.2/go.mod h1:Yj2daITit8TTBgiOpc26XCDSbg9xcFskUilHj9u3Mh8=
|
github.com/TwinProduction/gocache v1.2.3/go.mod h1:Yj2daITit8TTBgiOpc26XCDSbg9xcFskUilHj9u3Mh8=
|
||||||
github.com/TwinProduction/health v1.0.0 h1:TVyYTAORQQZ8LaptX8jCHZRCGCAO6e+oJx19BUIzQYY=
|
github.com/TwinProduction/health v1.0.0 h1:TVyYTAORQQZ8LaptX8jCHZRCGCAO6e+oJx19BUIzQYY=
|
||||||
github.com/TwinProduction/health v1.0.0/go.mod h1:ys4mYKUeEfYrWmkm60xLtPjTuLIEDQNBZaTZvenLG1c=
|
github.com/TwinProduction/health v1.0.0/go.mod h1:ys4mYKUeEfYrWmkm60xLtPjTuLIEDQNBZaTZvenLG1c=
|
||||||
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
|
||||||
|
2
vendor/github.com/TwinProduction/gocache/README.md
generated
vendored
2
vendor/github.com/TwinProduction/gocache/README.md
generated
vendored
@ -5,7 +5,7 @@
|
|||||||
[![codecov](https://codecov.io/gh/TwinProduction/gocache/branch/master/graph/badge.svg)](https://codecov.io/gh/TwinProduction/gocache)
|
[![codecov](https://codecov.io/gh/TwinProduction/gocache/branch/master/graph/badge.svg)](https://codecov.io/gh/TwinProduction/gocache)
|
||||||
[![Go version](https://img.shields.io/github/go-mod/go-version/TwinProduction/gocache.svg)](https://github.com/TwinProduction/gocache)
|
[![Go version](https://img.shields.io/github/go-mod/go-version/TwinProduction/gocache.svg)](https://github.com/TwinProduction/gocache)
|
||||||
[![Go Reference](https://pkg.go.dev/badge/github.com/TwinProduction/gocache.svg)](https://pkg.go.dev/github.com/TwinProduction/gocache)
|
[![Go Reference](https://pkg.go.dev/badge/github.com/TwinProduction/gocache.svg)](https://pkg.go.dev/github.com/TwinProduction/gocache)
|
||||||
[![Join Discord server](https://img.shields.io/discord/442432928614449155.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/44p4TRep)
|
[![Follow TwinProduction](https://img.shields.io/github/followers/TwinProduction?label=Follow&style=social)](https://github.com/TwinProduction)
|
||||||
|
|
||||||
gocache is an easy-to-use, high-performance, lightweight and thread-safe (goroutine-safe) in-memory key-value cache
|
gocache is an easy-to-use, high-performance, lightweight and thread-safe (goroutine-safe) in-memory key-value cache
|
||||||
with support for LRU and FIFO eviction policies as well as expiration, bulk operations and even persistence to file.
|
with support for LRU and FIFO eviction policies as well as expiration, bulk operations and even persistence to file.
|
||||||
|
14
vendor/github.com/TwinProduction/gocache/gocache.go
generated
vendored
14
vendor/github.com/TwinProduction/gocache/gocache.go
generated
vendored
@ -239,12 +239,12 @@ func (cache *Cache) SetWithTTL(key string, value interface{}, ttl time.Duration)
|
|||||||
Key: key,
|
Key: key,
|
||||||
Value: value,
|
Value: value,
|
||||||
RelevantTimestamp: time.Now(),
|
RelevantTimestamp: time.Now(),
|
||||||
previous: cache.head,
|
next: cache.head,
|
||||||
}
|
}
|
||||||
if cache.head == nil {
|
if cache.head == nil {
|
||||||
cache.tail = entry
|
cache.tail = entry
|
||||||
} else {
|
} else {
|
||||||
cache.head.next = entry
|
cache.head.previous = entry
|
||||||
}
|
}
|
||||||
cache.head = entry
|
cache.head = entry
|
||||||
cache.entries[key] = entry
|
cache.entries[key] = entry
|
||||||
@ -519,10 +519,10 @@ func (cache *Cache) moveExistingEntryToHead(entry *Entry) {
|
|||||||
cache.removeExistingEntryReferences(entry)
|
cache.removeExistingEntryReferences(entry)
|
||||||
}
|
}
|
||||||
if entry != cache.head {
|
if entry != cache.head {
|
||||||
entry.previous = cache.head
|
entry.next = cache.head
|
||||||
entry.next = nil
|
entry.previous = nil
|
||||||
if cache.head != nil {
|
if cache.head != nil {
|
||||||
cache.head.next = entry
|
cache.head.previous = entry
|
||||||
}
|
}
|
||||||
cache.head = entry
|
cache.head = entry
|
||||||
}
|
}
|
||||||
@ -536,9 +536,9 @@ func (cache *Cache) removeExistingEntryReferences(entry *Entry) {
|
|||||||
cache.tail = nil
|
cache.tail = nil
|
||||||
cache.head = nil
|
cache.head = nil
|
||||||
} else if cache.tail == entry {
|
} else if cache.tail == entry {
|
||||||
cache.tail = cache.tail.next
|
cache.tail = cache.tail.previous
|
||||||
} else if cache.head == entry {
|
} else if cache.head == entry {
|
||||||
cache.head = cache.head.previous
|
cache.head = cache.head.next
|
||||||
}
|
}
|
||||||
if entry.previous != nil {
|
if entry.previous != nil {
|
||||||
entry.previous.next = entry.next
|
entry.previous.next = entry.next
|
||||||
|
19
vendor/github.com/TwinProduction/gocache/janitor.go
generated
vendored
19
vendor/github.com/TwinProduction/gocache/janitor.go
generated
vendored
@ -33,7 +33,7 @@ func (cache *Cache) StartJanitor() error {
|
|||||||
}
|
}
|
||||||
cache.stopJanitor = make(chan bool)
|
cache.stopJanitor = make(chan bool)
|
||||||
go func() {
|
go func() {
|
||||||
// rather than starting from the tail on every run, we can try to start from the last next entry
|
// rather than starting from the tail on every run, we can try to start from the last traversed entry
|
||||||
var lastTraversedNode *Entry
|
var lastTraversedNode *Entry
|
||||||
totalNumberOfExpiredKeysInPreviousRunFromTailToHead := 0
|
totalNumberOfExpiredKeysInPreviousRunFromTailToHead := 0
|
||||||
backOff := JanitorMinShiftBackOff
|
backOff := JanitorMinShiftBackOff
|
||||||
@ -62,13 +62,14 @@ func (cache *Cache) StartJanitor() error {
|
|||||||
totalNumberOfExpiredKeysInPreviousRunFromTailToHead = 0
|
totalNumberOfExpiredKeysInPreviousRunFromTailToHead = 0
|
||||||
}
|
}
|
||||||
for current != nil {
|
for current != nil {
|
||||||
var next *Entry
|
// since we're walking from the tail to the head, we get the previous reference
|
||||||
|
var previous *Entry
|
||||||
steps++
|
steps++
|
||||||
if current.Expired() {
|
if current.Expired() {
|
||||||
expiredEntriesFound++
|
expiredEntriesFound++
|
||||||
// Because delete will remove the next reference from the entry, we need to store the
|
// Because delete will remove the previous reference from the entry, we need to store the
|
||||||
// next reference before we delete it
|
// previous reference before we delete it
|
||||||
next = current.next
|
previous = current.previous
|
||||||
cache.delete(current.Key)
|
cache.delete(current.Key)
|
||||||
cache.stats.ExpiredKeys++
|
cache.stats.ExpiredKeys++
|
||||||
}
|
}
|
||||||
@ -76,11 +77,11 @@ func (cache *Cache) StartJanitor() error {
|
|||||||
lastTraversedNode = nil
|
lastTraversedNode = nil
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// Travel to the current node's next node only if no specific next node has been specified
|
// Travel to the current node's previous node only if no specific previous node has been specified
|
||||||
if next != nil {
|
if previous != nil {
|
||||||
current = next
|
current = previous
|
||||||
} else {
|
} else {
|
||||||
current = current.next
|
current = current.previous
|
||||||
}
|
}
|
||||||
lastTraversedNode = current
|
lastTraversedNode = current
|
||||||
if steps == JanitorMaxIterationsPerShift || expiredEntriesFound >= JanitorShiftTarget {
|
if steps == JanitorMaxIterationsPerShift || expiredEntriesFound >= JanitorShiftTarget {
|
||||||
|
4
vendor/github.com/TwinProduction/gocache/persistence.go
generated
vendored
4
vendor/github.com/TwinProduction/gocache/persistence.go
generated
vendored
@ -120,8 +120,8 @@ func (cache *Cache) ReadFromFile(path string) (int, error) {
|
|||||||
cache.tail = current
|
cache.tail = current
|
||||||
cache.head = current
|
cache.head = current
|
||||||
} else {
|
} else {
|
||||||
previous.next = current
|
previous.previous = current
|
||||||
current.previous = previous
|
current.next = previous
|
||||||
cache.head = current
|
cache.head = current
|
||||||
}
|
}
|
||||||
previous = entries[i]
|
previous = entries[i]
|
||||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -1,7 +1,7 @@
|
|||||||
# cloud.google.com/go v0.74.0
|
# cloud.google.com/go v0.74.0
|
||||||
## explicit
|
## explicit
|
||||||
cloud.google.com/go/compute/metadata
|
cloud.google.com/go/compute/metadata
|
||||||
# github.com/TwinProduction/gocache v1.2.2
|
# github.com/TwinProduction/gocache v1.2.3
|
||||||
## explicit
|
## explicit
|
||||||
github.com/TwinProduction/gocache
|
github.com/TwinProduction/gocache
|
||||||
# github.com/TwinProduction/health v1.0.0
|
# github.com/TwinProduction/health v1.0.0
|
||||||
|
Loading…
Reference in New Issue
Block a user