lib/mize/global_clear.rb in mize-0.3.0 vs lib/mize/global_clear.rb in mize-0.3.1
- old
+ new
@@ -1,20 +1,16 @@
-require 'thread'
-
module Mize
- MUTEX = Mutex.new
-
class << self
# Clear all memoization caches at once.
def cache_clear
each_cache(&:clear)
end
private
def each_cache
- MUTEX.synchronize do
+ Mize::MUTEX.synchronize do
for cache in ObjectSpace.each_object(Mize::CacheProtocol)
yield cache
end
end
self