Class: Teems::Services::CacheStore
- Inherits:
-
Object
- Object
- Teems::Services::CacheStore
- Defined in:
- lib/teems/services/cache_store.rb
Overview
Manages caching of user and channel data
Instance Method Summary collapse
- #clear ⇒ Object
- #get_user(user_id) ⇒ Object
-
#initialize(paths: Support::XdgPaths.new) ⇒ CacheStore
constructor
A new instance of CacheStore.
- #set_user(user_id, display_name) ⇒ Object
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
#clear ⇒ Object
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 |