Skip to content

Commit 27b1c8e

Browse files
author
Ivan Zhakov
committed
Merge r1910026 from apr/trunk:
Align the apr_memcache API with the apr_reslist API. git-svn-id: https://svn.apache.org/repos/asf/apr/apr-util/branches/1.7.x@1925666 13f79535-47bb-0310-9956-ffa450edef68
1 parent 9b4fe1d commit 27b1c8e

3 files changed

Lines changed: 28 additions & 19 deletions

File tree

include/apr_memcache.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ struct apr_memcache_server_t
7474
apr_time_t btime;
7575
#if APR_HAS_THREADS
7676
/** Resource list parameters */
77-
apr_uint32_t min;
78-
apr_uint32_t smax;
79-
apr_uint32_t max;
80-
apr_uint32_t ttl;
77+
int min;
78+
int smax;
79+
int max;
80+
apr_interval_time_t ttl;
8181
#endif
8282
};
8383

@@ -246,10 +246,10 @@ APU_DECLARE(apr_time_t) apr_memcache_get_retry_period(apr_memcache_t *mc);
246246
APU_DECLARE(apr_status_t) apr_memcache_server_create(apr_pool_t *p,
247247
const char *host,
248248
apr_port_t port,
249-
apr_uint32_t min,
250-
apr_uint32_t smax,
251-
apr_uint32_t max,
252-
apr_uint32_t ttl,
249+
int min,
250+
int smax,
251+
int max,
252+
apr_interval_time_t ttl,
253253
apr_memcache_server_t **ns);
254254
/**
255255
* Creates a new memcached client object

memcache/apr_memcache.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,8 +459,8 @@ mc_conn_destruct(void *conn_, void *params, apr_pool_t *pool)
459459

460460
APU_DECLARE(apr_status_t) apr_memcache_server_create(apr_pool_t *p,
461461
const char *host, apr_port_t port,
462-
apr_uint32_t min, apr_uint32_t smax,
463-
apr_uint32_t max, apr_uint32_t ttl,
462+
int min, int smax,
463+
int max, apr_interval_time_t ttl,
464464
apr_memcache_server_t **ms)
465465
{
466466
apr_status_t rv = APR_SUCCESS;

test/testmemcache.c

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ static void test_memcache_create(abts_case * tc, void *data)
241241

242242
port = PORT + i;
243243
rv =
244-
apr_memcache_server_create(pool, HOST, PORT + i, 0, 1, 1, 60, &server);
244+
apr_memcache_server_create(pool, HOST, PORT + i, 0, 1, 1,
245+
apr_time_from_sec(60), &server);
245246
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
246247

247248
rv = apr_memcache_add_server(memcache, server);
@@ -263,7 +264,8 @@ static void test_memcache_create(abts_case * tc, void *data)
263264
ABTS_PTR_NOTNULL(tc, s);
264265
}
265266

266-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
267+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
268+
apr_time_from_sec(60), &server);
267269
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
268270

269271
rv = apr_memcache_add_server(memcache, server);
@@ -322,7 +324,8 @@ static void test_memcache_user_funcs(abts_case * tc, void *data)
322324
for(i = 1; i <= 10; i++) {
323325
apr_memcache_server_t *ms;
324326

325-
rv = apr_memcache_server_create(pool, HOST, i, 0, 1, 1, 60, &ms);
327+
rv = apr_memcache_server_create(pool, HOST, i, 0, 1, 1,
328+
apr_time_from_sec(60), &ms);
326329
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
327330

328331
rv = apr_memcache_add_server(memcache, ms);
@@ -358,7 +361,8 @@ static void test_memcache_meta(abts_case * tc, void *data)
358361
rv = apr_memcache_create(pool, 1, 0, &memcache);
359362
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
360363

361-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
364+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
365+
apr_time_from_sec(60), &server);
362366
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
363367

364368
rv = apr_memcache_add_server(memcache, server);
@@ -427,7 +431,8 @@ static void test_memcache_addreplace(abts_case * tc, void *data)
427431
rv = apr_memcache_create(pool, 1, 0, &memcache);
428432
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
429433

430-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
434+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
435+
apr_time_from_sec(60), &server);
431436
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
432437

433438
rv = apr_memcache_add_server(memcache, server);
@@ -491,7 +496,8 @@ static void test_memcache_incrdecr(abts_case * tc, void *data)
491496
rv = apr_memcache_create(pool, 1, 0, &memcache);
492497
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
493498

494-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
499+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
500+
apr_time_from_sec(60), &server);
495501
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
496502

497503
rv = apr_memcache_add_server(memcache, server);
@@ -548,7 +554,8 @@ static void test_memcache_multiget(abts_case * tc, void *data)
548554
rv = apr_memcache_create(pool, 1, 0, &memcache);
549555
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
550556

551-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
557+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
558+
apr_time_from_sec(60), &server);
552559
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
553560

554561
rv = apr_memcache_add_server(memcache, server);
@@ -621,7 +628,8 @@ static void test_memcache_setget(abts_case * tc, void *data)
621628
rv = apr_memcache_create(pool, 1, 0, &memcache);
622629
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
623630

624-
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1, 60, &server);
631+
rv = apr_memcache_server_create(pool, HOST, PORT, 0, 1, 1,
632+
apr_time_from_sec(60), &server);
625633
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
626634

627635
rv = apr_memcache_add_server(memcache, server);
@@ -714,7 +722,8 @@ static void test_connection_validation(abts_case *tc, void *data)
714722
rv = apr_memcache_create(p, 1, 0, &memcache);
715723
ABTS_ASSERT(tc, "memcache create failed", rv == APR_SUCCESS);
716724

717-
rv = apr_memcache_server_create(p, MOCK_HOST, MOCK_PORT, 0, 1, 1, 60000, &memserver);
725+
rv = apr_memcache_server_create(p, MOCK_HOST, MOCK_PORT, 0, 1, 1,
726+
apr_time_from_sec(60), &memserver);
718727
ABTS_ASSERT(tc, "server create failed", rv == APR_SUCCESS);
719728

720729
rv = apr_memcache_add_server(memcache, memserver);

0 commit comments

Comments
 (0)