(key string)
| 22 | type FileCache struct{} |
| 23 | |
| 24 | func (c FileCache) Get(key string) (string, time.Time) { |
| 25 | expires, value, err := c.readValue(key) |
| 26 | if err != nil { |
| 27 | return "", time.Time{} |
| 28 | } |
| 29 | expiresAt := time.Unix(expires, 0).UTC() |
| 30 | if expiresAt.Before(time.Now().UTC()) { |
| 31 | return "", time.Time{} |
| 32 | } |
| 33 | return value, expiresAt |
| 34 | } |
| 35 | |
| 36 | func (c FileCache) Set(key string, value string, expiresAt time.Time) { |
| 37 | path, err := c.cacheFilePath(key) |