def clear
      @lock.synchronize do
        if block_given?
          @items.each do |id, ref|
            begin
              yield id, ref.__getobj__
            rescue WeakRef::RefError
            end
          end
        end
        @items.clear
      end
    end
def clear
      @lock.synchronize do
        if block_given?
          @items.each do |id, ref|
            begin
              yield id, ref.__getobj__
            rescue WeakRef::RefError
            end
          end
        end
        @items.clear
      end
    end
Clears all items from the cache
 If block is given, iterates over the cached items