Class: ActiveMatrix::Util::RailsCacheAdapter

Inherits:
Object
  • Object
show all
Defined in:
lib/active_matrix/util/rails_cache_adapter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRailsCacheAdapter

Returns a new instance of RailsCacheAdapter.



8
9
10
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 8

def initialize
  @cache = ::Rails.cache
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



6
7
8
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 6

def client
  @client
end

Instance Method Details

#cleanupObject



32
33
34
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 32

def cleanup
  # Rails.cache handles its own cleanup
end

#clearObject



28
29
30
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 28

def clear
  @cache.clear
end

#delete(key) ⇒ Object



24
25
26
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 24

def delete(key)
  @cache.delete(key)
end

#exist?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 20

def exist?(key)
  @cache.exist?(key)
end

#read(key, _options = {}) ⇒ Object



12
13
14
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 12

def read(key, _options = {})
  @cache.read(key)
end

#write(key, value, expires_in: nil) ⇒ Object



16
17
18
# File 'lib/active_matrix/util/rails_cache_adapter.rb', line 16

def write(key, value, expires_in: nil)
  @cache.write(key, value, expires_in: expires_in)
end