1
0
Fork 0
mirror of https://github.com/KingDuckZ/incredis synced 2024-11-23 00:33:46 +00:00

Experimenting with passing binary ints on to redis.

This commit is contained in:
King_DuckZ 2017-06-21 21:10:26 +01:00
parent 7b1931bca0
commit d2fff64381
2 changed files with 11 additions and 1 deletions

View file

@ -19,6 +19,7 @@
#define id9348909738B047B7B6912D73CB519039
#include "duckhandy/compatibility.h"
#include "duckhandy/endianness.hpp"
#include <cstddef>
#include <boost/utility/string_view.hpp>
#include <string>
@ -76,6 +77,15 @@ namespace redis {
boost::string_view m_data;
};
template<>
struct MakeCharInfo<RedisInt> {
MakeCharInfo (RedisInt parValue) : m_value(dhandy::htobe(parValue)) {}
const char* data() const { return reinterpret_cast<const char*>(&m_value); }
std::size_t size() const { return sizeof(RedisInt); }
private:
RedisInt m_value;
};
template <typename T>
inline const char* arg_to_bin_safe_char (const T& parArg) {
return MakeCharInfo<T>(parArg).data();

@ -1 +1 @@
Subproject commit 7bcdb10d19d02d11ed22ec00bbea43198ec756e8
Subproject commit 3276bc64f4afbf3dee1256654700b763e89bcd98