Class: MWDictionaryAPI::MemoryCache

Inherits:
Object
  • Object
show all
Defined in:
lib/mw_dictionary_api/memory_cache.rb

Class Method Summary collapse

Class Method Details

.add(term, result) ⇒ Object



11
12
13
# File 'lib/mw_dictionary_api/memory_cache.rb', line 11

def self.add(term, result)
  cache[term] = result
end

.cacheObject



24
25
26
# File 'lib/mw_dictionary_api/memory_cache.rb', line 24

def self.cache
  @cache ||= {}
end

.clearObject

following methods are optional



20
21
22
# File 'lib/mw_dictionary_api/memory_cache.rb', line 20

def self.clear
  cache.clear
end

.find(term) ⇒ Object



7
8
9
# File 'lib/mw_dictionary_api/memory_cache.rb', line 7

def self.find(term)
  cache[term]
end

.remove(term) ⇒ Object



15
16
17
# File 'lib/mw_dictionary_api/memory_cache.rb', line 15

def self.remove(term)
  cache.delete(term)
end