( ctx context.Context, key string, parentKey string, value []byte, contentType string, )
| 380 | } |
| 381 | |
| 382 | func (c *PostgreSQLDependentCache) Insert( |
| 383 | ctx context.Context, key string, parentKey string, value []byte, contentType string, |
| 384 | ) error { |
| 385 | log := logger.FromContext(ctx) |
| 386 | |
| 387 | cacheKey := c.keyProvider.CacheKey(ctx, key) |
| 388 | if _, err := c.pool.Exec( |
| 389 | ctx, |
| 390 | "INSERT INTO dependent_values (key, parent_key, value, http_content_type, "+ |
| 391 | "expiration_timestamp) VALUES ($1, $2, $3, $4, $5)", |
| 392 | cacheKey, parentKey, value, contentType, time.Now().Add(dependentExpirationDuration), |
| 393 | ); err != nil { |
| 394 | log.Errorw("Error inserting dependent value", |
| 395 | "cacheKey", cacheKey, |
| 396 | "parentKey", parentKey, |
| 397 | "error", err, |
| 398 | ) |
| 399 | return err |
| 400 | } |
| 401 | |
| 402 | return nil |
| 403 | } |
| 404 | |
| 405 | func (c *PostgreSQLDependentCache) commit(ctx context.Context, parentKey string) error { |
| 406 | log := logger.FromContext(ctx) |
nothing calls this directly
no test coverage detected