Class: Snowly::SchemaCache

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/snowly/schema_cache.rb

Constant Summary collapse

SNOWPLOW_IGLU_RESOLVER =
'http://iglucentral.com/schemas/'
@@schema_cache =
{}

Instance Method Summary collapse

Instance Method Details

#[](location) ⇒ String

Provides easy access to the schema cache based on its registered key

Parameters:

  • location (String)

    Location provided in the schema

Returns:

  • (String)

    Json for schema



13
14
15
# File 'lib/snowly/schema_cache.rb', line 13

def [](location)
  @@schema_cache[location] || save_in_cache(location)
end

#cacheObject

Accessor to the global cache



23
24
25
# File 'lib/snowly/schema_cache.rb', line 23

def cache
  @@schema_cache
end

#reset_cacheObject

Resets the schema cache



18
19
20
# File 'lib/snowly/schema_cache.rb', line 18

def reset_cache
  @@schema_cache = {}
end