MCPcopy Create free account
hub / github.com/ContentSquare/chproxy / NewKey

Function NewKey

cache/key.go:64–82  ·  view source on GitHub ↗

NewKey construct cache key from provided parameters with default version number

(query []byte, originParams url.Values, acceptEncoding string, userParamsHash uint32, queryParamsHash uint32, userCredentialHash uint32)

Source from the content-addressed store, hash-verified

62
63// NewKey construct cache key from provided parameters with default version number
64func NewKey(query []byte, originParams url.Values, acceptEncoding string, userParamsHash uint32, queryParamsHash uint32, userCredentialHash uint32) *Key {
65 return &Key{
66 Query: query,
67 AcceptEncoding: acceptEncoding,
68 ClientProtocolVersion: originParams.Get("client_protocol_version"),
69 DefaultFormat: originParams.Get("default_format"),
70 Database: originParams.Get("database"),
71 Compress: originParams.Get("compress"),
72 EnableHTTPCompression: originParams.Get("enable_http_compression"),
73 Namespace: originParams.Get("cache_namespace"),
74 Extremes: originParams.Get("extremes"),
75 MaxResultRows: originParams.Get("max_result_rows"),
76 ResultOverflowMode: originParams.Get("result_overflow_mode"),
77 UserParamsHash: userParamsHash,
78 Version: Version,
79 QueryParamsHash: queryParamsHash,
80 UserCredentialHash: userCredentialHash,
81 }
82}
83
84func (k *Key) filePath(dir string) string {
85 return filepath.Join(dir, k.String())

Callers 2

newCacheKeyFunction · 0.92

Calls 1

GetMethod · 0.65

Tested by 1