GithubHelp home page GithubHelp logo

simpleredisclient's Introduction

Клиент для работы с редисом

This client tested only on Ubuntu, Debian, CentOS. (Этот клиент тестировался только под Ubuntu, Debian, CentOS)

В разных версиях redis имеются отличия в протоколе, чтоб не усложнять код и не плодить баги для каждой версии redis свой клинт.

Последние изменения

  • Добавлена поддержка redis версии 2.8
  • Автоматически переподключается при потере соединения
  • Добавлены некоторые функции от redis такие как select, dbsize и другие
  • Поправлены баги работы с сетью

Пример использования

int main(int argc, char *argv[])
{
    SimpleRedisClient rc;
rc.setHost(REDIS_HOST);
rc.auth(REDIS_PW);
rc.LogLevel(0);

if(!rc)
{
    printf("Соединение с redis не установлено\n");
    return -1;
}

rc = "MYKEY my-value-tester";
if(rc["MYKEY"])
{
    printf("MYKEY == [%d][%s]\n", (int)rc, (char*)rc);
}

printf("-------------------\n");
rc.sadd_printf("%s %d", "MY_SET", 123);
rc.sadd_printf("%s %d", "MY_SET", 14);

rc.smembers("MY_SET");

if(rc.getMultiBulkDataAmount())
{
    for(int i =0; i< rc.getMultiBulkDataAmount(); i++ )
    {
        printf("Answer[%d]->%s\n", i, rc.getData(i));
    }
}

rc = "MYKEY1 my-value-tester";
rc = "MYKEY2 my-value-tester";

rc.delete_keys("MY*");
 
rc.redis_close();

}

simpleredisclient's People

Contributors

victortrapenok avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.