remove accounts cache from basic auth middleware

move cache to ocis-pkg
add password validation cache to accounts service
This commit is contained in:
Florian Schade
2020-11-26 13:52:24 +01:00
parent e72328d738
commit 11ba46eb88
6 changed files with 35 additions and 49 deletions
+36
View File
@@ -0,0 +1,36 @@
package cache
import "time"
// Options are all the possible options.
type Options struct {
size int
ttl time.Duration
}
// Option mutates option
type Option func(*Options)
// Size configures the size of the cache in items.
func Size(s int) Option {
return func(o *Options) {
o.size = s
}
}
// TTL rebuilds the cache after the configured duration.
func TTL(ttl time.Duration) Option {
return func(o *Options) {
o.ttl = ttl
}
}
func newOptions(opts ...Option) Options {
o := Options{}
for _, v := range opts {
v(&o)
}
return o
}