Class: LaMaquina::Piston::CachePiston

Inherits:
Base
  • Object
show all
Defined in:
lib/la_maquina/piston/cache_piston.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.redisObject

Returns the value of attribute redis.



5
6
7
# File 'lib/la_maquina/piston/cache_piston.rb', line 5

def redis
  @redis
end

Class Method Details

.cache_key(notified_class, id) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/la_maquina/piston/cache_piston.rb', line 11

def cache_key(notified_class, id)

  key = redis_key notified_class, id

  cache_key = redis.get key
  # key found
  return cache_key if cache_key

  # there's no key; we can't very well rerun nil for cache_key. Let's make a new entry
  update_cache notified_class, id
end

.fire!(notified_class, id, notifier_class = "") ⇒ Object



7
8
9
# File 'lib/la_maquina/piston/cache_piston.rb', line 7

def fire!( notified_class, id, notifier_class = "" )
  update_cache notified_class, id
end