Introduction of cache interface and a file cacher.

This commit is contained in:
Burcu Dogan
2014-05-19 00:14:56 +02:00
parent 643fd905db
commit 227bfbf02f
3 changed files with 72 additions and 0 deletions

6
jwt.go
View File

@@ -66,6 +66,7 @@ type JWTConfig struct {
opts *JWTOptions
aud string
signature []byte
cache Cache
}
// Options returns JWT options.
@@ -153,3 +154,8 @@ func (c *JWTConfig) FetchToken(existing *Token) (token *Token, err error) {
token.Expiry = time.Now().Add(time.Duration(b.ExpiresIn) * time.Second)
return
}
// Cache returns a cache if specified, otherwise nil.
func (c *JWTConfig) Cache() Cache {
return c.cache
}