move cache to sync package

rollback indexer map
use sync.pool for cache entries
add tests for cache
remove main locks from nrwmutex and use sync.map and sync.pool instead
bump dockerfile go version
This commit is contained in:
Florian Schade
2021-01-19 23:23:41 +01:00
parent b81156fc57
commit f13530425a
12 changed files with 238 additions and 224 deletions
+3 -3
View File
@@ -10,9 +10,9 @@ import (
"github.com/dgrijalva/jwt-go"
gOidc "github.com/coreos/go-oidc"
"github.com/owncloud/ocis/ocis-pkg/cache"
"github.com/owncloud/ocis/ocis-pkg/log"
"github.com/owncloud/ocis/ocis-pkg/oidc"
"github.com/owncloud/ocis/ocis-pkg/sync"
"golang.org/x/oauth2"
)
@@ -24,7 +24,7 @@ type OIDCProvider interface {
// OIDCAuth provides a middleware to check access secured by a static token.
func OIDCAuth(optionSetters ...Option) func(next http.Handler) http.Handler {
options := newOptions(optionSetters...)
tokenCache := cache.NewCache(options.UserinfoCacheSize)
tokenCache := sync.NewCache(options.UserinfoCacheSize)
h := oidcAuth{
logger: options.Logger,
@@ -74,7 +74,7 @@ type oidcAuth struct {
providerFunc func() (OIDCProvider, error)
httpClient *http.Client
oidcIss string
tokenCache *cache.Cache
tokenCache *sync.Cache
tokenCacheTTL time.Duration
}