Sha256: 24176795a12a3502c43962a71229d1ff501e03d4cf0f0cf9833c5cce0729f9a3

Contents?: true

Size: 460 Bytes

Versions: 3

Compression:

Stored size: 460 Bytes

Contents

require 'set'

module NotificationCenter
  class Cache
    class << self
      def flush_cache!
        @cache = nil
      end

      def open_cache
        @cache ||= Set.new
      end

      def include? key
        open_cache.include? key
      end

      def << key
        open_cache << key
      end
    end

    def initialize app
      @app = app
    end

    def call env
      @app.call env
    ensure
      self.class.flush_cache!
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
notification_center-0.3.2 lib/notification_center/cache.rb
notification_center-0.3.1 lib/notification_center/cache.rb
notification_center-0.3 lib/notification_center/cache.rb