module Taskinator::Persistence::ClassMethods
Public Instance Methods
base_key()
click to toggle source
class must override this method to provide the base key to use for storing it's instances, and it must be unique!
# File lib/taskinator/persistence.rb, line 29 def base_key @base_key ||= 'shared' end
fetch(uuid, instance_cache={})
click to toggle source
fetches the instance for given identifier optionally, provide a hash to use for the instance cache this argument is defaulted, so top level callers don't need to provide this.
# File lib/taskinator/persistence.rb, line 42 def fetch(uuid, instance_cache={}) key = key_for(uuid) if instance_cache.key?(key) instance_cache[key] else instance_cache[key] = RedisDeserializationVisitor.new(key, instance_cache).visit end end
key_for(uuid)
click to toggle source
returns the storage key for the given identifier
# File lib/taskinator/persistence.rb, line 34 def key_for(uuid) "taskinator:#{base_key}:#{uuid}" end