MCPcopy
hub / github.com/dosco/graphjin / Get

Method Get

serv/mcp_cursor_cache.go:106–120  ·  view source on GitHub ↗

Get retrieves a cursor by its numeric ID

(ctx context.Context, id uint64)

Source from the content-addressed store, hash-verified

104
105// Get retrieves a cursor by its numeric ID
106func (c *RedisCursorCache) Get(ctx context.Context, id uint64) (string, error) {
107 ctx, cancel := context.WithTimeout(ctx, cursorRedisTimeout)
108 defer cancel()
109
110 idKey := cursorIDKey + fmt.Sprintf("%d", id)
111 cursor, err := c.client.Get(ctx, idKey).Result()
112 if err == redis.Nil {
113 return "", fmt.Errorf("cursor not found (ID: %d may have expired)", id)
114 }
115 if err != nil {
116 return "", fmt.Errorf("failed to get cursor: %w", err)
117 }
118
119 return cursor, nil
120}
121
122// Close closes the Redis connection
123func (c *RedisCursorCache) Close() error {

Callers

nothing calls this directly

Calls 1

GetMethod · 0.65

Tested by

no test coverage detected