Get retrieves a cursor by its numeric ID
(ctx context.Context, id uint64)
| 104 | |
| 105 | // Get retrieves a cursor by its numeric ID |
| 106 | func (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 |
| 123 | func (c *RedisCursorCache) Close() error { |