Class: Fushin::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/fushin/cache.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCache

Returns a new instance of Cache.



8
9
10
# File 'lib/fushin/cache.rb', line 8

def initialize
  @cache = Lightly.new(dir: "/tmp/fushin", life: "48h")
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



7
8
9
# File 'lib/fushin/cache.rb', line 7

def cache
  @cache
end

Class Method Details

.cached?(key) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/fushin/cache.rb', line 20

def self.cached?(key)
  new.cache.cached? key
end

.get(key) ⇒ Object



12
13
14
# File 'lib/fushin/cache.rb', line 12

def self.get(key)
  new.cache.get key
end

.save(key, value) ⇒ Object



16
17
18
# File 'lib/fushin/cache.rb', line 16

def self.save(key, value)
  new.cache.save(key, value)
end