Module: Gitlab::Database::PostgresqlAdapter::TypeMapCache
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/gitlab/database/postgresql_adapter/type_map_cache.rb
Constant Summary collapse
- TYPE_MAP_CACHE_MONITOR =
::Monitor.new
Instance Method Summary collapse
Instance Method Details
#initialize_type_map(map = type_map) ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/gitlab/database/postgresql_adapter/type_map_cache.rb', line 24 def initialize_type_map(map = type_map) TYPE_MAP_CACHE_MONITOR.synchronize do cached_type_map = self.class.type_map_cache[@connection_parameters.hash] break @type_map = cached_type_map if cached_type_map super self.class.type_map_cache[@connection_parameters.hash] = map end end |
#reload_type_map ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gitlab/database/postgresql_adapter/type_map_cache.rb', line 34 def reload_type_map # This method is also called when a connection is initialized. # We only want to clear the cache when @type_map is present and we are actually reloading. if @type_map TYPE_MAP_CACHE_MONITOR.synchronize do self.class.type_map_cache[@connection_parameters.hash] = nil end end super end |