~piotr-sikora/libmemcached/fix-tests-on-openbsd

« back to all changes in this revision

Viewing changes to docs/libmemcached_examples.rst

Merge in all new docs

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
distribution. These are always up to date, and are used for each test run of
14
14
the library.
15
15
 
16
 
------------------------------
17
 
Creating and Freeing structure
18
 
------------------------------
 
16
-----------------------------------------------
 
17
Creating and Freeing the memcached_st structure
 
18
-----------------------------------------------
19
19
 
20
20
 
21
21
.. code-block:: c
51
51
In the above code you create a \ ``memcached_st``\  object with three server by making use of :manpage:`memcached_create_with_options(3)`.
52
52
 
53
53
 
 
54
--------------------------
 
55
Creating a pool of servers
 
56
--------------------------
 
57
 
 
58
 
 
59
 
 
60
.. code-block:: c
 
61
 
 
62
  const char *config_string= "--SERVER=host10.example.com --SERVER=host11.example.com --SERVER=host10.example.com"; 
 
63
  
 
64
  memcached_pool_st* pool= memcached_pool(config_string, strlen(config_string));
 
65
 
 
66
  memcached_return_t rc;
 
67
 
 
68
  memcached_st *memc= memcached_pool_pop(pool, false, &rc);
 
69
 
 
70
  .... do work
 
71
 
 
72
  /*
 
73
    Release the memc_ptr that was pulled from the pool
 
74
  */
 
75
  memcached_pool_push(pool, memc);
 
76
 
 
77
  /*
 
78
    Destroy the pool.
 
79
  */
 
80
  memcached_pool_destroy(pool);
 
81
 
 
82
 
 
83
 
 
84
In the above code you create a \ ``memcached_pool_st``\  object with three
 
85
server by making use of :manpage:`memcached_pool(3)`.
 
86
 
 
87
When memcached_pool_destroy() all memory will be released that is associated
 
88
with the pool.
 
89
 
 
90
 
54
91
----------------------------
55
92
Adding a value to the server
56
93
----------------------------