class Atompub::SimpleCache
Atompub::SimpleCache
¶ ↑
Basic cache storage class. Use Hash object to store data.
Public Class Methods
instance()
click to toggle source
Get singleton instance
# File lib/atomutil.rb, line 1185 def self.instance @@singleton = self.new if @@singleton.nil? @@singleton end
new()
click to toggle source
initializer
# File lib/atomutil.rb, line 1190 def initialize @cache = Hash.new end
Public Instance Methods
get(uri)
click to toggle source
Pick cache resource from hash for indicated uri.
# File lib/atomutil.rb, line 1194 def get(uri) @cache.has_key?(uri) ? @cache[uri] : nil end
put(uri, params)
click to toggle source
Set cache resource into hash.
# File lib/atomutil.rb, line 1198 def put(uri, params) @cache[uri] = CacheResource.new(params) end