ProductPromotion
Logo

Elixir

made by https://0x3d.site

GitHub - artemeff/redis: Redis commands for Elixir
Redis commands for Elixir. Contribute to artemeff/redis development by creating an account on GitHub.
Visit Site

GitHub - artemeff/redis: Redis commands for Elixir

GitHub - artemeff/redis: Redis commands for Elixir

Redis Build Status Hex.pm


Redis commands for Elixir. If you are looking for exredis, please check out exredis branch.



Installation

Add this to the dependencies:

{:redis, "~> 0.1"}

Usage

Redis commands have a few simple types: enums, commands and primitive. Types can be required and optional, multiple and variadic, can be composite.

Situation with required and optional types is simple: required types are just arguments in function and optional values passed with the last argument — opts. opts is just a list, opts described in typespecs for each command.

Multiple arguments are arguments that contain one or more values. Multiple arguments can be optional.

Enum types in Redis is just a enumerable (usually), take a look at xx | nx enum:

iex> Redis.set("key", "value", [:xx])
["SET", [" ", "key"], [" ", "value"], [], [" ", "XX"]]

iex> Redis.set("key", "value", [:nx])
["SET", [" ", "key"], [" ", "value"], [], [" ", "NX"]]

Commands are prefixed types, commands can wrap primitive types, enums and composite types:

# command with enum inside
iex> Redis.client_kill(type: :master)
["CLIENT KILL", [], [], [" ", ["TYPE", " ", "master"]], [], []]

# command with primitive type inside
iex> Redis.client_kill(id: "identity")
["CLIENT KILL", [], [" ", ["ID", " ", "identity"]], [], [], []]

# command with composite type inside, inner type of get is: {String.t, integer()}
iex> Redis.bitfield("key", get: {"type", "offset"})
["BITFIELD", [" ", "key"], [" ", ["GET", " ", ["type", " ", "offset"]]], [], [], []]

You can see the usage for every Redis command in IEx:

iex> h Redis.set

  def set(key, value, opts \\ [])

  @spec set(
          key :: key(),
          value :: String.t(),
          opts :: [
            {:expiration, {:ex, :integer} | {:px, :integer}}
            | (:nx | :xx)
            | {:condition, :nx | :xx}
          ]
        ) :: iolist()

since: 1.0.0

Set the string value of a key

Group: string.

Or head to the documentation on hexdocs.


Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Articles
to learn more about the elixir concepts.

Resources
which are currently available to browse on.

mail [email protected] to add your project or resources here 🔥.

FAQ's
to know more about the topic.

mail [email protected] to add your project or resources here 🔥.

Queries
or most google FAQ's about Elixir.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory