* Initialize config cache and prepare callbacks. This is split out of * lookup_ts_config_cache because we need to activate the callback before * caching TSCurrentConfigCache, too. */
| 359 | * caching TSCurrentConfigCache, too. |
| 360 | */ |
| 361 | static void |
| 362 | init_ts_config_cache(void) |
| 363 | { |
| 364 | HASHCTL ctl; |
| 365 | |
| 366 | ctl.keysize = sizeof(Oid); |
| 367 | ctl.entrysize = sizeof(TSConfigCacheEntry); |
| 368 | TSConfigCacheHash = hash_create("Tsearch configuration cache", 16, |
| 369 | &ctl, HASH_ELEM | HASH_BLOBS); |
| 370 | /* Flush cache on pg_ts_config and pg_ts_config_map changes */ |
| 371 | CacheRegisterSyscacheCallback(TSCONFIGOID, InvalidateTSCacheCallBack, |
| 372 | PointerGetDatum(TSConfigCacheHash)); |
| 373 | CacheRegisterSyscacheCallback(TSCONFIGMAP, InvalidateTSCacheCallBack, |
| 374 | PointerGetDatum(TSConfigCacheHash)); |
| 375 | |
| 376 | /* Also make sure CacheMemoryContext exists */ |
| 377 | if (!CacheMemoryContext) |
| 378 | CreateCacheMemoryContext(); |
| 379 | } |
| 380 | |
| 381 | /* |
| 382 | * Fetch configuration cache entry |
no test coverage detected