plug_mishka_auth v0.0.2 MishkaAuth.RedisClient View Source

You will be able to handle Redis with this module, it has CRUD functions to use Redis, it should be noted it does your work with easy way

Link to this section Summary

Functions

get expire time of singel record

with this function you can connect to redis file for example redis-server redis.conf, its password was put like hardcode. you should change it in future.

Link to this section Functions

Link to this function

convert_output_of_get_all_fields_of_record_redis(params)

View Source

Specs

convert_output_of_get_all_fields_of_record_redis(maybe_improper_list()) ::
  {:error, :get_all_fields_of_record_redis, <<_::256>>}
  | {:ok, :get_all_fields_of_record_redis, any()}
Link to this function

delete_field_of_record_redis(table_name, record_id, field_name)

View Source

Specs

delete_field_of_record_redis(binary(), binary(), any()) ::
  {:error,
   atom()
   | %{
       :__exception__ => any(),
       :__struct__ => Redix.ConnectionError | Redix.Error,
       optional(:message) => binary(),
       optional(:reason) => atom()
     }}
  | {:ok,
     :delete_field_of_record_redis
     | [
         nil
         | binary()
         | [nil | binary() | [any()] | integer() | map()]
         | integer()
         | Redix.Error.t()
       ]}
  | {:error, :delete_field_of_record_redis | :get_all_fields_of_record_redis,
     <<_::256>>}

delete singel field of redis record

Link to this function

delete_record_of_redis(table_name, record_id)

View Source

Specs

delete_record_of_redis(binary(), binary()) ::
  {:error, :get_all_fields_of_record_redis, <<_::256>>}
  | {:ok, :delete_record_of_redis, <<_::168>>}

delete redis record

Link to this function

get_all_fields_of_record_redis(table_name, record_id)

View Source

Specs

get_all_fields_of_record_redis(binary(), binary()) :: [
  nil
  | binary()
  | [nil | binary() | [any()] | integer() | Redix.Error.t()]
  | integer()
  | Redix.Error.t()
]

show all fields of redis record

Link to this function

get_data_of_singel_id(table_name, record_id)

View Source

Specs

get_data_of_singel_id(binary(), binary()) ::
  {:error, :get_all_fields_of_record_redis, <<_::256>>}
  | {:ok, :get_data_of_singel_id, map()}
Link to this function

get_expire_time_of_redis(table_name, record_id)

View Source

Specs

get_expire_time_of_redis(binary(), binary()) ::
  {:error, :get_expire_time_error_handler, <<_::256>>}
  | {:ok, :get_expire_time,
     nil
     | binary()
     | [nil | binary() | [any()] | integer() | map()]
     | integer()
     | Redix.Error.t()}

get expire time of singel record

Link to this function

get_singel_field_record_of_redis(table_name, record_id, field_name)

View Source

Specs

get_singel_field_record_of_redis(any(), any(), any()) :: [
  nil
  | binary()
  | [nil | binary() | [any()] | integer() | Redix.Error.t()]
  | integer()
  | Redix.Error.t()
]

show singel fields of redis record

Link to this function

insert_or_update_into_redis(table_name, record_id, params, expire_time)

View Source

Specs

insert_or_update_into_redis(binary(), binary(), map(), any()) ::
  {:ok, :insert_or_update_into_redis}

with this function you can connect to redis file for example redis-server redis.conf, its password was put like hardcode. you should change it in future.

def connect_to_redis do

Redix.pipeline(:redix, [["AUTH","9GXXnt2qtqLv7p2fYvBWE1kAWif1OXRMHOL/7IoSvCLBF5v0+eCwasYXGeeoxaT6KAQE8HB0jCwcoz+6"]]) # will be changed

end

this function can be used ether insering data to redis or update data, the type of expire_time is seconds. the params type is Map - tuple.

Link to this function

update_expire_time_of_redis(table_name, record_id, expire_time)

View Source

Specs

update_expire_time_of_redis(binary(), binary(), any()) ::
  {:error, :update_expire_time_of_error_handler, <<_::256>>}
  | {:ok, :update_expire_time_of_redis, <<_::240>>}

get expire time of singel record