Sha256: c7c5a0c08c291f6b9c7bf76d2ffa27d5211f4ec753ca6fee3c2c4d01e1d8fd3e

Contents?: true

Size: 590 Bytes

Versions: 43

Compression:

Stored size: 590 Bytes

Contents

module Contentful
  # Cache for Content Types
  class ContentTypeCache
    @cache = {}

    class << self
      attr_reader :cache
    end

    # Clears the Content Type Cache
    def self.clear!
      @cache = {}
    end

    # Gets a Content Type from the Cache
    def self.cache_get(space_id, content_type_id)
      @cache.fetch(space_id, {}).fetch(content_type_id.to_sym, nil)
    end

    # Sets a Content Type in the Cache
    def self.cache_set(space_id, content_type_id, klass)
      @cache[space_id] ||= {}
      @cache[space_id][content_type_id.to_sym] = klass
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
contentful-2.17.1 lib/contentful/content_type_cache.rb
contentful-2.17.0 lib/contentful/content_type_cache.rb
contentful-2.16.3 lib/contentful/content_type_cache.rb
contentful-2.16.2 lib/contentful/content_type_cache.rb
contentful-2.16.1 lib/contentful/content_type_cache.rb
contentful-2.16.0 lib/contentful/content_type_cache.rb
contentful-2.15.4 lib/contentful/content_type_cache.rb
contentful-2.15.3 lib/contentful/content_type_cache.rb
contentful-2.15.2 lib/contentful/content_type_cache.rb
contentful-2.15.1 lib/contentful/content_type_cache.rb
contentful-2.15.0 lib/contentful/content_type_cache.rb
contentful-2.14.0 lib/contentful/content_type_cache.rb
contentful-2.13.3 lib/contentful/content_type_cache.rb
contentful-2.13.2 lib/contentful/content_type_cache.rb
contentful-2.13.1 lib/contentful/content_type_cache.rb
contentful-2.13.0 lib/contentful/content_type_cache.rb
contentful-2.12.0 lib/contentful/content_type_cache.rb
contentful-2.11.1 lib/contentful/content_type_cache.rb
contentful-2.11.0 lib/contentful/content_type_cache.rb
contentful-2.10.1 lib/contentful/content_type_cache.rb