(sessionKey string)
| 156 | } |
| 157 | |
| 158 | func (cache *PersistentClientSessionCache) Get(sessionKey string) (*tls.ClientSessionState, bool) { |
| 159 | var data []byte |
| 160 | err := cache.db.View(func(tx *bbolt.Tx) error { |
| 161 | bucket := tx.Bucket(bucketName) |
| 162 | if bucket == nil { |
| 163 | return nil |
| 164 | } |
| 165 | data = bucket.Get([]byte(sessionKey)) |
| 166 | return nil |
| 167 | }) |
| 168 | if err != nil { |
| 169 | cache.logger.Error("cache db: key %q read failed: %v", err) |
| 170 | return nil, false |
| 171 | } |
| 172 | if data == nil { |
| 173 | return nil, false |
| 174 | } |
| 175 | cs, err := clientSessionStateFromBytes(data) |
| 176 | if err != nil { |
| 177 | if err == ErrFormatVersionMismatch { |
| 178 | cache.logger.Debug("rejected cached ticket for key %q due to version mismatch", sessionKey) |
| 179 | } else { |
| 180 | cache.logger.Error("cached session recovery failed: %v", err) |
| 181 | } |
| 182 | } |
| 183 | return cs, true |
| 184 | } |
| 185 | |
| 186 | func (cache *PersistentClientSessionCache) delete(sessionKey string) { |
| 187 | err := cache.db.Update(func(tx *bbolt.Tx) error { |
nothing calls this directly
no test coverage detected