def save
      # Autoincremental ID unless specified
      unless @cached_attrs.include?(:id)
        add_attribute :id, @@redis.incr("#{self.class.name}:autoincrement")
        add_attribute :created_at, Time.now.to_f.to_s
        add_attribute :updated_at, Time.now.to_f.to_s
        @@redis.push_tail("#{self.class.name}:list", @cached_attrs[:id]) # List of all the class objects
      end

      # Store each @cached_attrs
      stored = Set.new
      (@cached_attrs.keys - @stored_attrs.to_a).each do |k|
          stored << k 
          @stored_attrs << k
          @@redis.set_add("#{self.class.name}:#{id}:attrs", k.to_s)
          @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:#{k}", @cached_attrs[k])
      end

      # updated_at
      @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:updated_at", Time.now.to_f.to_s)
      stored << :updated_at 

      # Relationships
      @@reflections[self.class.name.to_sym][:belongs_to].each do |klass|
        @@redis.set_add("#{klass.to_s.camelize}:#{@cached_attrs[klass.to_s.foreign_key.to_sym]}:_#{self.class.name.underscore}_ids", @cached_attrs[:id])
      end

      return stored.to_a
    end
def save
      # Autoincremental ID unless specified
      unless @cached_attrs.include?(:id)
        add_attribute :id, @@redis.incr("#{self.class.name}:autoincrement")
        add_attribute :created_at, Time.now.to_f.to_s
        add_attribute :updated_at, Time.now.to_f.to_s
        @@redis.push_tail("#{self.class.name}:list", @cached_attrs[:id]) # List of all the class objects
      end

      # Store each @cached_attrs
      stored = Set.new
      (@cached_attrs.keys - @stored_attrs.to_a).each do |k|
          stored << k 
          @stored_attrs << k
          @@redis.set_add("#{self.class.name}:#{id}:attrs", k.to_s)
          @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:#{k}", @cached_attrs[k])
      end

      # updated_at
      @@redis.set("#{self.class.name}:#{@cached_attrs[:id]}:updated_at", Time.now.to_f.to_s)
      stored << :updated_at 

      # Relationships
      @@reflections[self.class.name.to_sym][:belongs_to].each do |klass|
        @@redis.set_add("#{klass.to_s.camelize}:#{@cached_attrs[klass.to_s.foreign_key.to_sym]}:_#{self.class.name.underscore}_ids", @cached_attrs[:id])
      end

      return stored.to_a
    end
Class methods
 Instantiate a new object with the given *attrs* hash.
 Save the (non-stored) object attributes to Redis.