awesomized / libmemcached

Resurrection of libmemcached
https://awesomized.github.io/libmemcached/
BSD 3-Clause "New" or "Revised" License
45 stars 26 forks source link

Please help with the example #110

Closed StasToken closed 3 years ago

StasToken commented 3 years ago

Hello, sorry to write here, but I'm still a very young developer, and please provide me with an example of reading a string from the memcached storage-I can't really find anything on the Internet on this topic. I tried this, but it doesn't return the expected string...

    Memcache first_client("--SERVER=127.0.0.1:11211");
    first_client.addServer("127.0.0.1", 11211);
    std::vector<char> ret_val;
    ret_val.resize(100);
    bool a = first_client.get("HLWRD", ret_val);
    for (auto const &element: ret_val)
    std::cout << element << ' ';

Please give an example of reading a string by a key! very necessary!

m6w6 commented 3 years ago

I guess you wanted to use std::vector::reserve() instead of ::resize().

Please direct your general programming questions to an appropriate medium, this is an issue tracker, thus not an appropriate place, thanks.

StasToken commented 3 years ago

@m6w6 - I have been waiting for a week for an answer to this question on the sites stackoverflow.com and qna.habr.com, But I didn't get anything except one comment, it seems that no one uses this library at all - I can't even find examples in google

StasToken commented 3 years ago

I actually wrote here already out of desperation...

m6w6 commented 3 years ago

I already gave you the answer. It is a C++ STL usage error, not libmemcached usage error.