Class: Teems::Services::CacheStore

Inherits:
Object
  • Object
show all
Defined in:
lib/teems/services/cache_store.rb

Overview

Manages caching of user and channel data

Instance Method Summary collapse

Constructor Details

#initialize(paths: Support::XdgPaths.new) ⇒ CacheStore

Returns a new instance of CacheStore.



7
8
9
10
# File 'lib/teems/services/cache_store.rb', line 7

def initialize(paths: Support::XdgPaths.new)
  @paths = paths
  @user_cache = {}
end

Instance Method Details

#clearObject



20
21
22
23
# File 'lib/teems/services/cache_store.rb', line 20

def clear
  @user_cache.clear
  FileUtils.rm_f(users_cache_file)
end

#get_user(user_id) ⇒ Object



12
13
14
# File 'lib/teems/services/cache_store.rb', line 12

def get_user(user_id)
  @user_cache[user_id]
end

#set_user(user_id, display_name) ⇒ Object



16
17
18
# File 'lib/teems/services/cache_store.rb', line 16

def set_user(user_id, display_name)
  @user_cache[user_id] = display_name
end