def generate_alias_key alias_name, args = {}
      #check if asked dynamic alias exists
      raise ArgumentError, "Unknown dynamic alias: '#{alias_name}', use: #{redis_alias_config.keys.join(", ")} " unless redis_alias_config.has_key?(alias_name.to_sym)

      #normalize input hash of arguments
      args = HashWithIndifferentAccess.new(args)

      # prepare class name + dynamic + alias name
      out = "#{self.name.to_s.underscore.to_sym}:alias:#{alias_name}"

      #get config 
      config = redis_alias_config[alias_name.to_sym]

      # use all specified keys
      config[:main_fields].each do |key|
        out += add_item_to_redis_key args, key
      end

      #is alias dynamic?
      if config[:order_field] && config[:args_field]
        #check if input arguments has order field
        if args.has_key?(config[:order_field]) && args[config[:order_field]] && args.has_key?(config[:args_field]) && args[config[:args_field]]
          #use filed order from defined field in args
          args[config[:order_field]].each do |key|
            out += add_item_to_redis_key args[config[:args_field]], key
          end
        else 
          # use global search
          out += ":*"
        end
      end

      out    
    end
def generate_alias_key alias_name, args = {}
      #check if asked dynamic alias exists
      raise ArgumentError, "Unknown dynamic alias: '#{alias_name}', use: #{redis_alias_config.keys.join(", ")} " unless redis_alias_config.has_key?(alias_name.to_sym)

      #normalize input hash of arguments
      args = HashWithIndifferentAccess.new(args)

      # prepare class name + dynamic + alias name
      out = "#{self.name.to_s.underscore.to_sym}:alias:#{alias_name}"

      #get config 
      config = redis_alias_config[alias_name.to_sym]

      # use all specified keys
      config[:main_fields].each do |key|
        out += add_item_to_redis_key args, key
      end

      #is alias dynamic?
      if config[:order_field] && config[:args_field]
        #check if input arguments has order field
        if args.has_key?(config[:order_field]) && args[config[:order_field]] && args.has_key?(config[:args_field]) && args[config[:args_field]]
          #use filed order from defined field in args
          args[config[:order_field]].each do |key|
            out += add_item_to_redis_key args[config[:args_field]], key
          end
        else 
          # use global search
          out += ":*"
        end
      end

      out    
    end
Generates redis key for storing indexes for dynamic aliases
 will produce something like: your_class:dynamic:name_of_your_dynami_alias:field_value2:field_value1...
 (field values are sorted by fields order)
 * dynamic_alias_name (Symbol) - name of your dynamic alias
 * args (Hash) - arguments of your model
 * field_order (Array of symbols) - order of fields (ex. [:field2, :field1])
 * field_args (Hash) - hash of values for aliasing (ex. {:field1 => "field_value1", :field2 => "field_value2"})