Class: TeamboxThingsSync::Cache::BaseCache

Inherits:
Object
  • Object
show all
Defined in:
lib/teambox-things-sync/cache/base_cache.rb

Direct Known Subclasses

TaskListCache, UserNameCache

Instance Method Summary collapse

Constructor Details

#initialize(client, config = {}) ⇒ BaseCache

Returns a new instance of BaseCache.



5
6
7
8
9
# File 'lib/teambox-things-sync/cache/base_cache.rb', line 5

def initialize(client, config = {})
  @data = {}
  @client = client
  @config = config
end

Instance Method Details

#[](id) ⇒ Object



11
12
13
14
15
16
# File 'lib/teambox-things-sync/cache/base_cache.rb', line 11

def [](id)
  if @data[id].nil?
    @data[id] = query_api(id)
  end
  @data[id]
end