Sha256: 38f23da5e4f3efb97b0fb98c2c05e47a82293d14a141672a8b94013c393dd290

Contents?: true

Size: 332 Bytes

Versions: 10

Compression:

Stored size: 332 Bytes

Contents

module Mize
  class << self

    # Clear all memoization caches at once.
    def cache_clear
      each_cache(&:clear)
    end

    private

    def each_cache
      Mize::MUTEX.synchronize do
        for cache in ObjectSpace.each_object(Mize::CacheProtocol)
          yield cache
        end
      end
      self
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mize-0.6.1 lib/mize/global_clear.rb
mize-0.6.0 lib/mize/global_clear.rb
mize-0.5.0 lib/mize/global_clear.rb
mize-0.4.1 lib/mize/global_clear.rb
mize-0.4.0 lib/mize/global_clear.rb
mize-0.3.5 lib/mize/global_clear.rb
mize-0.3.4 lib/mize/global_clear.rb
mize-0.3.3 lib/mize/global_clear.rb
mize-0.3.2 lib/mize/global_clear.rb
mize-0.3.1 lib/mize/global_clear.rb