Skip to content

funbox/eredis_sync

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 26 commits ahead of miros:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

eredis_sync

Erlang CI

A simple Redis client which uses an optimized version of eredis parser to interact with Redis through a simple gen_tcp socket, without any gen_server wrapper or smth.

Build

make

Tests

make test

One needs to have local redis-server installed to run tests.

Usage

With rebar, add actual version of the library to rebar.config, for example:

{eredis_sync, ".*",
    {git, "https://github.com/funbox/eredis_sync.git", {ref, "v0.1.4"}}},

or add it as a Hex dependency:

{deps,[
  eredis_sync
  %% {eredis_sync,"0.1.4"}
]}.

Example

{ok, Conn} = eredis_sync:connect({127,0,0,1}, 6379),
{ok, <<"PONG">>} = eredis_sync:q(Conn, ["PING"]),

Timeout = 1000,
[
  {ok, _},
  {ok, <<"1">>},
  {ok, <<"1">>},
  {ok, [<<"1">>, <<"2">>]}
] = eredis_sync:qp(Conn1, [
  ["DEL", "S"],
  ["SADD", "S", "1"],
  ["SADD", "S", "2"],
  ["SMEMBERS", "S"]
], Timeout),

{error, _} = eredis_sync:q(Conn2, ["PANG"]),

ok = eredis_sync:close(Conn3).

Sponsored by FunBox

About

Simple Redis client operating directly on a socket

Topics

Resources

License

Stars

Watchers

Forks

Languages

  • Erlang 92.3%
  • Makefile 6.5%
  • Lua 1.2%