You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: json.go
    path of file: ./repos/rueidis/om
    
    the code of the file until where you have to start completion: package om

import (
	"context"
	"encoding/json"
	"reflect"
	"strconv"
	"strings"
	"time"

	"github.com/redis/rueidis"
)

// NewJSONRepository creates an JSONRepository.
// The prefix parameter is used as redis key prefix. The en
    
func (r *JSONRepository[T]) FetchCache(ctx context.Context, id string, ttl time.Duration) (v *T, err error) {
	record, err := r.client.DoCache(ctx, r.client.B().JsonGet().Key(key(r.prefix, id)).Path(".").Cache(), ttl).ToString()
	if err == nil {
		v, err = r.decode(record)
	}
	return v, err
}