class Contentful::ContentTypeCache

Cache for Content Types

Attributes

cache[R]

Public Class Methods

cache_get(space_id, content_type_id) click to toggle source

Gets a Content Type from the Cache

# File lib/contentful/content_type_cache.rb, line 16
def self.cache_get(space_id, content_type_id)
  @cache.fetch(space_id, {}).fetch(content_type_id.to_sym, nil)
end
cache_set(space_id, content_type_id, klass) click to toggle source

Sets a Content Type in the Cache

# File lib/contentful/content_type_cache.rb, line 21
def self.cache_set(space_id, content_type_id, klass)
  @cache[space_id] ||= {}
  @cache[space_id][content_type_id.to_sym] = klass
end
clear!() click to toggle source

Clears the Content Type Cache

# File lib/contentful/content_type_cache.rb, line 11
def self.clear!
  @cache = {}
end