From 89c5a32885c60799653325e71813d2efd122978e Mon Sep 17 00:00:00 2001 From: mchavez Date: Tue, 3 Sep 2024 14:47:44 -0600 Subject: [PATCH] Code review changes part 3 --- pkg/uhttp/dbcache.go | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/pkg/uhttp/dbcache.go b/pkg/uhttp/dbcache.go index a0801fd5..9b82fc3f 100644 --- a/pkg/uhttp/dbcache.go +++ b/pkg/uhttp/dbcache.go @@ -521,29 +521,3 @@ func (d *DBCache) getStats(ctx context.Context) (Stats, error) { Misses: int64(misses), }, nil } - -// Len computes number of entries in cache. -func (d *DBCache) len(ctx context.Context) (int, error) { - var count int = 0 - if d.IsNilConnection() { - return -1, fmt.Errorf("%s", nilConnection) - } - - l := ctxzap.Extract(ctx) - rows, err := d.db.QueryContext(ctx, `SELECT count(*) FROM http_cache`) - if err != nil { - l.Debug(errQueryingTable, zap.Error(err)) - return -1, err - } - - defer rows.Close() - for rows.Next() { - err = rows.Scan(&count) - if err != nil { - l.Debug("Failed to scan rows from table", zap.Error(err)) - return -1, err - } - } - - return count, nil -}