(ctx context.Context, key string)
| 354 | } |
| 355 | |
| 356 | func (c *PostgreSQLDependentCache) Get(ctx context.Context, key string) ([]byte, string, error) { |
| 357 | log := logger.FromContext(ctx) |
| 358 | |
| 359 | cacheKey := c.keyProvider.CacheKey(ctx, key) |
| 360 | var value []byte |
| 361 | var contentType string |
| 362 | |
| 363 | err := c.pool.QueryRow( |
| 364 | ctx, |
| 365 | "SELECT value, http_content_type FROM dependent_values WHERE key=$1", |
| 366 | cacheKey, |
| 367 | ).Scan(&value, &contentType) |
| 368 | if err != nil { |
| 369 | if err != pgx.ErrNoRows { |
| 370 | // An actual error |
| 371 | log.Warnw("Unhandled sql error", "error", err) |
| 372 | return nil, "", err |
| 373 | } |
| 374 | |
| 375 | // Cache entry didn't exist |
| 376 | return nil, "", nil |
| 377 | } |
| 378 | |
| 379 | return value, contentType, nil |
| 380 | } |
| 381 | |
| 382 | func (c *PostgreSQLDependentCache) Insert( |
| 383 | ctx context.Context, key string, parentKey string, value []byte, contentType string, |
nothing calls this directly
no test coverage detected