class MMS::Cache
Attributes
storage[RW]
Public Class Methods
new()
click to toggle source
# File lib/mms/cache.rb, line 10 def initialize @storage = Hash.new { |hash, key| hash[key] = nil } end
Public Instance Methods
clear()
click to toggle source
# File lib/mms/cache.rb, line 31 def clear initialize end
delete(key)
click to toggle source
@param [String] key
# File lib/mms/cache.rb, line 27 def delete(key) @storage.delete key unless @storage[key].nil? end
get(key)
click to toggle source
@param [String] key @return [Object]
# File lib/mms/cache.rb, line 22 def get(key) @storage[key].nil? ? nil : @storage[key] end
set(key, value)
click to toggle source
@param [String] key @param [Object] value
# File lib/mms/cache.rb, line 16 def set(key, value) @storage[key] = value end