def value_transform value, type
      return nil if value.nil? || value.to_s.size == 0
      case type
      when :integer then value.to_i
      when :autoincrement then value.to_i
      when :string then value.to_s
      when :float then value.to_f
      when :bool then value.to_s
      when :symbol then value.to_s
      when :marshal then Marshal.dump(value)
      when :array then Yajl::Encoder.encode(value)
      when :hash then Yajl::Encoder.encode(value)
      when :time then Time.parse(value.to_s).strftime("%Y.%m.%d %H:%M:%S")
      when :date then Date.parse(value.to_s).strftime("%Y-%m-%d")
      else value
      end
    end
def value_transform value, type
      return nil if value.nil? || value.to_s.size == 0
      case type
      when :integer then value.to_i
      when :autoincrement then value.to_i
      when :string then value.to_s
      when :float then value.to_f
      when :bool then value.to_s
      when :symbol then value.to_s
      when :marshal then Marshal.dump(value)
      when :array then Yajl::Encoder.encode(value)
      when :hash then Yajl::Encoder.encode(value)
      when :time then Time.parse(value.to_s).strftime("%Y.%m.%d %H:%M:%S")
      when :date then Date.parse(value.to_s).strftime("%Y-%m-%d")
      else value
      end
    end
def value_transform value , type return nil if value . nil? || value . to_s . size == 0 case type when :integer then value . to_i when :autoincrement then value . to_i when :string then value . to_s when :float then value . to_f when :bool then value . to_s when :symbol then value . to_s when :marshal then Marshal . dump ( value ) when :array then Yajl :: Encoder . encode ( value ) when :hash then Yajl :: Encoder . encode ( value ) when :time then Time . parse ( value . to_s ) . strftime ( "%Y.%m.%d %H:%M:%S" ) when :date then Date . parse ( value . to_s ) . strftime ( "%Y-%m-%d" ) else value end end
convert value for valid format which can be saved in redis
convert value for valid format which can be saved in redis