diff --git a/internal/store_lookup.go b/internal/store_lookup.go new file mode 100644 index 0000000..18c8e13 --- /dev/null +++ b/internal/store_lookup.go @@ -0,0 +1,10 @@ +package internal + +// Exists reports whether key is present in the store, without allocating a +// value copy -- useful for existence checks ahead of a Set/Delete. +func (s *Store) Exists(key string) bool { + s.mu.RLock() + defer s.mu.RUnlock() + _, ok := s.data[key] + return ok +}