Sha256: 37706e80da3848855bbe5dd5ac8c20b98ae62c3c3113c95f0d45c6222961b00b

Contents?: true

Size: 1.15 KB

Versions: 60

Compression:

Stored size: 1.15 KB

Contents

module Sass
  module CacheStores
    # A backend for the Sass cache using in-process memory.
    class Memory < Base
      # Since the {Memory} store is stored in the Sass tree's options hash,
      # when the options get serialized as part of serializing the tree,
      # you get crazy exponential growth in the size of the cached objects
      # unless you don't dump the cache.
      #
      # @private
      def _dump(depth)
        ""
      end

      # If we deserialize this class, just make a new empty one.
      #
      # @private
      def self._load(repr)
        Memory.new
      end

      # Create a new, empty cache store.
      def initialize
        @contents = {}
      end

      # @see Base#retrieve
      def retrieve(key, sha)
        return unless @contents.has_key?(key)
        return unless @contents[key][:sha] == sha
        obj = @contents[key][:obj]
        obj.respond_to?(:deep_copy) ? obj.deep_copy : obj.dup
      end

      # @see Base#store
      def store(key, sha, obj)
        @contents[key] = {:sha => sha, :obj => obj}
      end

      # Destructively clear the cache.
      def reset!
        @contents = {}
      end
    end
  end
end

Version data entries

60 entries across 59 versions & 6 rubygems

Version Path
files.com-1.0.55 docs/vendor/bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
chatops-rpc-0.0.2 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
chatops-rpc-0.0.1 fixtures/chatops-controller-example/vendor/bundle/ruby/2.5.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/sass-3.7.4/lib/sass/cache_stores/memory.rb
sass-3.7.4 lib/sass/cache_stores/memory.rb
brakeman-4.4.0 bundle/ruby/2.5.0/gems/sass-3.4.25/lib/sass/cache_stores/memory.rb
sass-3.7.3 lib/sass/cache_stores/memory.rb
sass-3.7.2 lib/sass/cache_stores/memory.rb
sass-3.7.1 lib/sass/cache_stores/memory.rb
sass-3.7.0 lib/sass/cache_stores/memory.rb
sass-3.6.0 lib/sass/cache_stores/memory.rb