class OnlineGHAProvider::Cache
Public Class Methods
new(max_size = 10)
click to toggle source
# File lib/gh-archive.rb, line 361 def initialize(max_size = 10) @cache = {} @max_size = max_size @mutex = Mutex.new end
Public Instance Methods
full?()
click to toggle source
# File lib/gh-archive.rb, line 389 def full? self.size >= @max_size end
get(name)
click to toggle source
# File lib/gh-archive.rb, line 373 def get(name) @mutex.synchronize do return @cache.delete(name) end end
has?(name)
click to toggle source
# File lib/gh-archive.rb, line 385 def has?(name) return @cache.has_key?(name) end
put(name, content)
click to toggle source
# File lib/gh-archive.rb, line 367 def put(name, content) @mutex.synchronize do @cache[name] = content end end
size()
click to toggle source
# File lib/gh-archive.rb, line 379 def size @mutex.synchronize do return @cache.size end end