Sha256: b2b81209deac480e85f90f04a1a6753bf98286d08579620c67110ddcc6028ad1

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

# frozen_string_literal: true
module Sprockets
  class Cache
    # Public: A compatible cache store that doesn't store anything. Used by
    # default when no Environment#cache is configured.
    #
    # Assign the instance to the Environment#cache.
    #
    #     environment.cache = Sprockets::Cache::NullStore.new
    #
    # See Also
    #
    #   ActiveSupport::Cache::NullStore
    #
    class NullStore
      # Public: Simulate a cache miss.
      #
      # This API should not be used directly, but via the Cache wrapper API.
      #
      # key - String cache key.
      #
      # Returns nil.
      def get(key)
        nil
      end

      # Public: Simulate setting a value in the cache.
      #
      # This API should not be used directly, but via the Cache wrapper API.
      #
      # key   - String cache key.
      # value - Object value.
      #
      # Returns Object value.
      def set(key, value)
        value
      end

      # Public: Pretty inspect
      #
      # Returns String.
      def inspect
        "#<#{self.class}>"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
sprockets-4.0.0.beta4 lib/sprockets/cache/null_store.rb
sprockets-4.0.0.beta3 lib/sprockets/cache/null_store.rb