123456789_123456789_123456789_123456789_123456789_

Module: Nokogiri::CSS::SelectorCache

Do not use. This module is for internal use only.
Relationships & Source Files
Defined in: lib/nokogiri/css/selector_cache.rb

Class Method Summary

Class Method Details

.[](key)

Retrieve the cached XPath expressions for the key

[ GitHub ]

  
# File 'lib/nokogiri/css/selector_cache.rb', line 11

def [](key)
  @mutex.synchronize { @cache[key] }
end

.[]=(key, value)

Insert the XPath expressions value at the cache key

[ GitHub ]

  
# File 'lib/nokogiri/css/selector_cache.rb', line 16

def []=(key, value)
  @mutex.synchronize { @cache[key] = value }
end

.clear_cache(create_new_object = false)

Clear the cache

[ GitHub ]

  
# File 'lib/nokogiri/css/selector_cache.rb', line 21

def clear_cache(create_new_object = false)
  @mutex.synchronize do
    if create_new_object # used in tests to avoid 'method redefined' warnings when injecting spies
      @cache = {}
    else
      @cache.clear
    end
  end
end

.key(selector:, visitor:)

Construct a unique key cache key

[ GitHub ]

  
# File 'lib/nokogiri/css/selector_cache.rb', line 32

def key(selector:, visitor:)
  [selector, visitor.config]
end