Skip to content

Commit

Permalink
FEATURE: Add multi-storage operations.
Browse files Browse the repository at this point in the history
  • Loading branch information
uhm0311 committed Aug 21, 2024
1 parent 69ac3b6 commit e8e028f
Show file tree
Hide file tree
Showing 5 changed files with 858 additions and 15 deletions.
10 changes: 10 additions & 0 deletions libmemcached/libmemcached_probes.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,16 @@
#define LIBMEMCACHED_MEMCACHED_SET_END_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_SET_START()
#define LIBMEMCACHED_MEMCACHED_SET_START_ENABLED() (0)

// multi-storage operations
#define LIBMEMCACHED_MEMCACHED_MADD_END()
#define LIBMEMCACHED_MEMCACHED_MADD_END_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_MADD_START()
#define LIBMEMCACHED_MEMCACHED_MADD_START_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_MREPLACE_END()
#define LIBMEMCACHED_MEMCACHED_MREPLACE_END_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_MREPLACE_START()
#define LIBMEMCACHED_MEMCACHED_MREPLACE_START_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_MSET_END()
#define LIBMEMCACHED_MEMCACHED_MSET_END_ENABLED() (0)
#define LIBMEMCACHED_MEMCACHED_MSET_START()
Expand Down
109 changes: 109 additions & 0 deletions libmemcached/storage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,46 @@ memcached_return_t memcached_mset(memcached_st *ptr,
return memcached_mset_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_madd(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
return memcached_madd_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_mreplace(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
return memcached_mreplace_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_mprepend(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
return memcached_mprepend_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_mappend(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
return memcached_mappend_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_mcas(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
return memcached_mcas_by_key(ptr, NULL, 0, req, number_of_req, results);
}

memcached_return_t memcached_mset_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
Expand All @@ -936,3 +976,72 @@ memcached_return_t memcached_mset_by_key(memcached_st *ptr,
LIBMEMCACHED_MEMCACHED_MSET_END();
return rc;
}

memcached_return_t memcached_madd_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
memcached_return_t rc;
LIBMEMCACHED_MEMCACHED_MADD_START();
rc= memcached_send_multi(ptr, group_key, group_key_length,
req, number_of_req, ADD_OP, results);
LIBMEMCACHED_MEMCACHED_MADD_END();
return rc;
}

memcached_return_t memcached_mreplace_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
memcached_return_t rc;
LIBMEMCACHED_MEMCACHED_MREPLACE_START();
rc= memcached_send_multi(ptr, group_key, group_key_length,
req, number_of_req, REPLACE_OP, results);
LIBMEMCACHED_MEMCACHED_MREPLACE_END();
return rc;
}

memcached_return_t memcached_mprepend_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
memcached_return_t rc;
rc= memcached_send_multi(ptr, group_key, group_key_length,
req, number_of_req, PREPEND_OP, results);
return rc;
}

memcached_return_t memcached_mappend_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
memcached_return_t rc;
rc= memcached_send_multi(ptr, group_key, group_key_length,
req, number_of_req, APPEND_OP, results);
return rc;
}

memcached_return_t memcached_mcas_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results)
{
memcached_return_t rc;
rc= memcached_send_multi(ptr, group_key, group_key_length,
req, number_of_req, CAS_OP, results);
return rc;
}
70 changes: 70 additions & 0 deletions libmemcached/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,36 @@ memcached_return_t memcached_mset(memcached_st *ptr,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_madd(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mreplace(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mprepend(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mappend(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mcas(memcached_st *ptr,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mset_by_key(memcached_st *ptr,
const char *group_key,
Expand All @@ -153,6 +183,46 @@ memcached_return_t memcached_mset_by_key(memcached_st *ptr,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_madd_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mreplace_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mprepend_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mappend_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

LIBMEMCACHED_API
memcached_return_t memcached_mcas_by_key(memcached_st *ptr,
const char *group_key,
size_t group_key_length,
const memcached_storage_request_st *req,
const size_t number_of_req,
memcached_return_t *results);

#ifdef __cplusplus
}
#endif
Expand Down
Loading

0 comments on commit e8e028f

Please sign in to comment.