Skip to content

Commit

Permalink
Refactoring code
Browse files Browse the repository at this point in the history
  • Loading branch information
mchavez committed Aug 27, 2024
1 parent f498202 commit 77c3f69
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions pkg/uhttp/dbcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,6 @@ func (d *DBCache) Insert(ctx context.Context, key string, value any) error {
}

if ok, _ := d.Has(ctx, key); !ok {
d.mu.RLock()
defer d.mu.RUnlock()
_, err := d.db.Exec("INSERT INTO http_cache(key, data, expiration) values(?, ?, ?)",
key,
bytes,
Expand Down Expand Up @@ -251,8 +249,6 @@ func (d *DBCache) Select(ctx context.Context, key string) ([]byte, error) {
func (d *DBCache) Remove(ctx context.Context, key string) error {
l := ctxzap.Extract(ctx)
if ok, _ := d.Has(ctx, key); ok {
d.mu.RLock()
defer d.mu.RUnlock()
_, err := d.db.Exec("DELETE FROM http_cache WHERE key = ?", key)
if err != nil {
l.Debug("error deleting key", zap.Error(err))
Expand Down

0 comments on commit 77c3f69

Please sign in to comment.