Module: TFSGraph::StoreHelpers

Included in:
AbstractStore, GraphPopulator, Populators::Utilities
Defined in:
lib/tfs_graph/store_helpers.rb

Constant Summary collapse

UPDATED_KEY =
"LAST_UPDATED_ON"

Instance Method Summary collapse

Instance Method Details

#flush_allObject

flush by key so that we only disturbe our namespace



9
10
11
# File 'lib/tfs_graph/store_helpers.rb', line 9

def flush_all
  RepositoryRegistry.project_repository.drop_all
end

#last_updated_onObject



18
19
20
21
22
23
# File 'lib/tfs_graph/store_helpers.rb', line 18

def last_updated_on
  date = redis.get(UPDATED_KEY)
  return Time.at(0).localtime unless date

  Time.parse(date).localtime
end

#mark_as_updated(time = nil) ⇒ Object



13
14
15
16
# File 'lib/tfs_graph/store_helpers.rb', line 13

def mark_as_updated(time=nil)
  time ||= Time.now
  redis.set UPDATED_KEY, time.utc
end