Class: App::Cache

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/aws_cache.rb

Class Method Summary collapse

Class Method Details

.exists?(key) ⇒ Boolean

Checks if a key exists but doesn’t actually parse it.

Returns:

  • (Boolean)

    boolean



35
36
37
38
39
40
41
# File 'lib/aws/aws_cache.rb', line 35

def self.exists?(key)

    # TODO

    false

end

.get(key) ⇒ Object

Returns either the data or nil. Nil will be returned in 2 cases, the key doesn’t exist or the data has expired.

Returns:

  • Object|nil



25
26
27
28
29
30
31
# File 'lib/aws/aws_cache.rb', line 25

def self.get(key)

    # TODO

    nil

end

.invalidate(key) ⇒ Object

Invalidate a cache key. Does nothing if key doesn’t exist.

Returns:

  • void



45
46
47
48
49
# File 'lib/aws/aws_cache.rb', line 45

def self.invalidate(key)

    # TODO

end

.store(key, data, expire_hours = nil) ⇒ Object

Stores a string representation of a Array/Hash/String in the /tmp directory using a unique key + timestamp. Key is the unique key used for retrieving it – stored as constant in class above ^ App::CacheKey Data can be either anything. It will simply be stored as object.inspect. Expire hours is the amount of hours this Hash should be stored for.

Returns:

  • void



16
17
18
19
20
# File 'lib/aws/aws_cache.rb', line 16

def self.store(key, data, expire_hours = nil)

    # TODO

end