Class: LogtoClient::RailsCacheStorage

Inherits:
AbstractStorage show all
Defined in:
lib/logto/client/index_storage.rb

Instance Method Summary collapse

Constructor Details

#initialize(app_id: nil) ⇒ RailsCacheStorage

Returns a new instance of RailsCacheStorage.



55
56
57
# File 'lib/logto/client/index_storage.rb', line 55

def initialize(app_id: nil)
  @app_id = app_id
end

Instance Method Details

#get(key) ⇒ Object



59
60
61
# File 'lib/logto/client/index_storage.rb', line 59

def get(key)
  Rails.cache.read(getCacheKey(key))
end

#remove(key) ⇒ Object



67
68
69
# File 'lib/logto/client/index_storage.rb', line 67

def remove(key)
  Rails.cache.delete(getCacheKey(key))
end

#set(key, value) ⇒ Object



63
64
65
# File 'lib/logto/client/index_storage.rb', line 63

def set(key, value)
  Rails.cache.write(getCacheKey(key), value, force: true)
end