From 8fc42bccbe1445d538674a50567df17fbfc4874d Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 8 Jul 2026 21:20:20 +0200 Subject: changed shards struct to use RWMutex and added executeRead --- handlers.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'handlers.go') diff --git a/handlers.go b/handlers.go index b4668f8..2f07500 100644 --- a/handlers.go +++ b/handlers.go @@ -15,7 +15,7 @@ func handleGet(conn net.Conn, args []string) { key := args[1] - result := db.Execute(key, func(s *Shard) interface{}{ + result := db.ExecuteRead(key, func(s *Shard) interface{}{ item, exists := s.data[key] if !exists { return nil @@ -46,7 +46,7 @@ func handleExists(conn net.Conn, args []string) { } key := args[1] - result := db.Execute(key, func(s *Shard) interface{}{ + result := db.ExecuteRead(key, func(s *Shard) interface{}{ _, exists := s.data[key] if exists { return 1 -- cgit v1.2.3