Sha256: e478b7750625298a7faaf916d318f8d129ad8cb077b0adb56868d4b0258a063b
Contents?: true
Size: 1.25 KB
Versions: 3
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true # @api public # @since 0.5.0 module AnyCache::Plugins require_relative 'plugins/abstract' require_relative 'plugins/registry' require_relative 'plugins/interface_access_mixin' # @since 0.5.0 @plugin_registry = Registry.new # @since 0.5.0 @access_lock = Mutex.new class << self # @param plugin_name [Symbol, String] # @return [void] # # @api public # @since 0.5.0 def load(plugin_name) thread_safe { plugin_registry[plugin_name].load! } end # @return [Array<String>] # # @api public # @since 0.5.0 def names thread_safe { plugin_registry.names } end # @param plugin_name [Symbol, String] # @return [void] # # @api private # @since 0.5.0 def register(plugin_name, plugin_module) thread_safe { plugin_registry[plugin_name] = plugin_module } end private # @return [AnyCache::Plugins::Registry] # # @api private # @since 0.5.0 attr_reader :plugin_registry # @return [Mutex] # # @api private # @since 0.5.0 attr_reader :access_lock # @return [void] # # @api private # @since 0.5.0 def thread_safe access_lock.synchronize { yield if block_given? } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
any_cache-0.7.0 | lib/any_cache/plugins.rb |
any_cache-0.6.0 | lib/any_cache/plugins.rb |
any_cache-0.5.0 | lib/any_cache/plugins.rb |