aboutsummaryrefslogtreecommitdiff
path: root/handlers.go
diff options
context:
space:
mode:
authoralex <[email protected]>2026-07-08 21:20:20 +0200
committeralex <[email protected]>2026-07-08 21:20:20 +0200
commit8fc42bccbe1445d538674a50567df17fbfc4874d (patch)
tree4b9f541200a06aab615bad7738275fadb52a34ac /handlers.go
parent917b08a98cb310d05170d2ef3de9847419e3990e (diff)
downloadredis-clone-8fc42bccbe1445d538674a50567df17fbfc4874d.tar.xz
redis-clone-8fc42bccbe1445d538674a50567df17fbfc4874d.zip
changed shards struct to use RWMutex and added executeRead
Diffstat (limited to 'handlers.go')
-rw-r--r--handlers.go4
1 files changed, 2 insertions, 2 deletions
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