implement and use striped LRU cache to lower mutex contention (#15764)

* Implement Striped LRU cache

* ci

* fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Florent Peterschmitt
2020-12-09 14:55:14 +01:00
коммит произвёл GitHub
родитель 96d76760f0
Коммит 349b83f23a
34 изменённых файлов: 872 добавлений и 203 удалений

7
services/cache/mocks/Cache.go поставляемый
Просмотреть файл

@@ -2,8 +2,11 @@
package mocks
import mock "github.com/stretchr/testify/mock"
import time "time"
import (
time "time"
mock "github.com/stretchr/testify/mock"
)
// Cache is an autogenerated mock type for the Cache type
type Cache struct {

11
services/cache/mocks/Provider.go поставляемый
Просмотреть файл

@@ -41,7 +41,7 @@ func (_m *Provider) Connect() error {
}
// NewCache provides a mock function with given fields: opts
func (_m *Provider) NewCache(opts *cache.CacheOptions) cache.Cache {
func (_m *Provider) NewCache(opts *cache.CacheOptions) (cache.Cache, error) {
ret := _m.Called(opts)
var r0 cache.Cache
@@ -53,5 +53,12 @@ func (_m *Provider) NewCache(opts *cache.CacheOptions) cache.Cache {
}
}
return r0
var r1 error
if rf, ok := ret.Get(1).(func(*cache.CacheOptions) error); ok {
r1 = rf(opts)
} else {
r1 = ret.Error(1)
}
return r0, r1
}