MCPcopy Index your code
hub / github.com/Permify/permify / setPlanCacheMode

Function setPlanCacheMode

pkg/database/postgres/postgres.go:243–270  ·  view source on GitHub ↗
(config *pgx.ConnConfig)

Source from the content-addressed store, hash-verified

241}
242
243func setPlanCacheMode(config *pgx.ConnConfig) {
244 // Default plan cache mode
245 const defaultMode = "auto"
246
247 // Extract connection string
248 connStr := config.ConnString()
249 planCacheMode := defaultMode
250
251 // Check for specific plan cache modes in the connection string
252 for key, value := range planCacheModes {
253 if strings.Contains(connStr, "plan_cache_mode="+key) {
254 if key == "disable" {
255 delete(config.RuntimeParams, "plan_cache_mode")
256 slog.Info("setPlanCacheMode", slog.String("mode", "disabled"))
257 return
258 }
259 planCacheMode = value
260 slog.Info("setPlanCacheMode", slog.String("mode", key))
261 break
262 }
263 }
264
265 // Set the plan cache mode
266 config.RuntimeParams["plan_cache_mode"] = planCacheMode
267 if planCacheMode == defaultMode {
268 slog.Warn("setPlanCacheMode", slog.String("mode", defaultMode))
269 }
270}
271
272// createPools initializes read and write connection pools with appropriate configurations and error handling.
273func createPools(ctx context.Context, wConfig, rConfig *pgxpool.Config) (*pgxpool.Pool, *pgxpool.Pool, error) {

Callers 1

newDBFunction · 0.85

Calls 3

InfoMethod · 0.80
WarnMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected