Update 更新会话
(ctx context.Context, req *UpdateRequest)
| 70 | |
| 71 | // Update 更新会话 |
| 72 | func (s *InMemoryService) Update(ctx context.Context, req *UpdateRequest) error { |
| 73 | s.mu.Lock() |
| 74 | defer s.mu.Unlock() |
| 75 | |
| 76 | session, ok := s.sessions[req.SessionID] |
| 77 | if !ok { |
| 78 | return ErrSessionNotFound |
| 79 | } |
| 80 | |
| 81 | if req.Metadata != nil { |
| 82 | maps.Copy(session.metadata, req.Metadata) |
| 83 | } |
| 84 | |
| 85 | session.lastUpdateTime = time.Now() |
| 86 | return nil |
| 87 | } |
| 88 | |
| 89 | // Delete 删除会话 |
| 90 | func (s *InMemoryService) Delete(ctx context.Context, sessionID string) error { |