| 336 | var dependentExpirationDuration = 24 * time.Hour |
| 337 | |
| 338 | func (c *PostgreSQLDependentCache) loadFromDatabase(ctx context.Context, cacheKey string) (*Response, error) { |
| 339 | var response Response |
| 340 | err := c.pool.QueryRow( |
| 341 | ctx, |
| 342 | "SELECT value, http_status_code, http_content_type FROM cache WHERE key=$1", |
| 343 | cacheKey, |
| 344 | ).Scan(&response.Payload, &response.StatusCode, &response.ContentType) |
| 345 | if err == nil { |
| 346 | return &response, nil |
| 347 | } |
| 348 | |
| 349 | if err != pgx.ErrNoRows { |
| 350 | return nil, err |
| 351 | } |
| 352 | |
| 353 | return nil, nil |
| 354 | } |
| 355 | |
| 356 | func (c *PostgreSQLDependentCache) Get(ctx context.Context, key string) ([]byte, string, error) { |
| 357 | log := logger.FromContext(ctx) |