Class: MMS::Cache
Instance Attribute Summary collapse
- 
  
    
      #storage  ⇒ Object 
    
    
  
  
  
  
    
    
  
  
  
  
  
  
    Returns the value of attribute storage. 
Instance Method Summary collapse
- #clear ⇒ Object
- #delete(key) ⇒ Object
- #get(key) ⇒ Object
- 
  
    
      #initialize  ⇒ Cache 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Cache. 
- #set(key, value) ⇒ Object
Constructor Details
#initialize ⇒ Cache
| 10 11 12 | # File 'lib/mms/cache.rb', line 10 def initialize @storage = Hash.new { |hash, key| hash[key] = nil } end | 
Instance Attribute Details
#storage ⇒ Object
Returns the value of attribute storage.
| 7 8 9 | # File 'lib/mms/cache.rb', line 7 def storage @storage end | 
Instance Method Details
#clear ⇒ Object
| 31 32 33 | # File 'lib/mms/cache.rb', line 31 def clear initialize end | 
#delete(key) ⇒ Object
| 27 28 29 | # File 'lib/mms/cache.rb', line 27 def delete(key) @storage.delete key unless @storage[key].nil? end | 
#get(key) ⇒ Object
| 22 23 24 | # File 'lib/mms/cache.rb', line 22 def get(key) @storage[key].nil? ? nil : @storage[key] end | 
#set(key, value) ⇒ Object
| 16 17 18 | # File 'lib/mms/cache.rb', line 16 def set(key, value) @storage[key] = value end |