lib/alephant/publisher/sqs_helper/archiver.rb in alephant-publisher-0.2.9 vs lib/alephant/publisher/sqs_helper/archiver.rb in alephant-publisher-0.3.0

- old
+ new

@@ -1,5 +1,7 @@ +require 'date' + module Alephant module Publisher module SQSHelper class Archiver attr_reader :cache, :async @@ -19,17 +21,21 @@ def async_store(m) Thread.new { store(m) } end def store(m) - cache.put("archive/#{m.id}", m.body, meta_for(m)) + cache.put("archive/#{date_key}/#{m.id}", m.body, meta_for(m)) end + def date_key + DateTime.now.strftime('%d-%m-%Y_%H') + end + def meta_for(m) { :id => m.id, :md5 => m.md5, - :logged_at => Time.now.to_s, + :logged_at => DateTime.now.to_s, :queue => m.queue.url, } end end end