Main Page | Modules | Data Structures | File List | Data Fields | Globals

Memcached Client Routines


Data Structures

struct  apr_memcache_server_t
struct  apr_memcache_t
struct  apr_memcache_stats_t

Typedefs

typedef apr_memcache_conn_t apr_memcache_conn_t
typedef apr_memcache_server_t apr_memcache_server_t

Enumerations

enum  apr_memcache_server_status_t { APR_MC_SERVER_LIVE, APR_MC_SERVER_DEAD }

Functions

 apr_memcache_hash (const char *data, apr_uint32_t data_len)
 apr_memcache_find_server_hash (apr_memcache_t *mc, const apr_uint32_t hash)
 apr_memcache_add_server (apr_memcache_t *mc, apr_memcache_server_t *server)
 apr_memcache_find_server (apr_memcache_t *mc, const char *host, apr_port_t port)
 apr_memcache_enable_server (apr_memcache_t *mc, apr_memcache_server_t *ms)
 apr_memcache_disable_server (apr_memcache_t *mc, apr_memcache_server_t *ms)
 apr_memcache_server_create (apr_pool_t *p, const char *host, apr_port_t port, apr_uint32_t min, apr_uint32_t smax, apr_uint32_t max, apr_uint32_t ttl, apr_memcache_server_t **ns)
 apr_memcache_create (apr_pool_t *p, apr_uint16_t max_servers, apr_uint32_t flags, apr_memcache_t **mc)
 apr_memcache_getp (apr_memcache_t *mc, apr_pool_t *p, const char *key, char **baton, apr_size_t *len, apr_uint32_t *flags)
 apr_memcache_set (apr_memcache_t *mc, const char *key, char *baton, const apr_uint32_t data_size, apr_uint32_t timeout, apr_uint32_t flags)
 apr_memcache_add (apr_memcache_t *mc, const char *key, char *baton, const apr_uint32_t data_size, apr_uint32_t timeout, apr_uint32_t flags)
 apr_memcache_replace (apr_memcache_t *mc, const char *key, char *data, const apr_uint32_t data_size, apr_uint32_t timeout, apr_uint32_t flags)
 apr_memcache_delete (apr_memcache_t *mc, const char *key, apr_uint32_t timeout)
 apr_memcache_incr (apr_memcache_t *mc, const char *key, apr_int32_t n, apr_uint32_t *nv)
 apr_memcache_decr (apr_memcache_t *mc, const char *key, apr_int32_t n, apr_uint32_t *new_value)
 apr_memcache_version (apr_memcache_server_t *ms, apr_pool_t *p, char **baton)
 apr_memcache_stats (apr_memcache_server_t *ms, apr_pool_t *p, apr_memcache_stats_t **stats)

Typedef Documentation

typedef struct apr_memcache_conn_t apr_memcache_conn_t
 

Opaque memcache client connection object

typedef struct apr_memcache_server_t apr_memcache_server_t
 

Memcache Server Info Object


Enumeration Type Documentation

enum apr_memcache_server_status_t
 

Specifies the status of a memcached server

Enumeration values:
APR_MC_SERVER_LIVE  Server is alive and responding to requests
APR_MC_SERVER_DEAD  Server is not responding to requests


Function Documentation

apr_memcache_add apr_memcache_t mc,
const char *  key,
char *  baton,
const apr_uint32_t  data_size,
apr_uint32_t  timeout,
apr_uint32_t  flags
 

Adds value by key on the server

Parameters:
mc client to use
key null terminated string containing the key
baton data to store on the server
len length of data at baton
timeout time for the data to live on the server
flags any flags set by the client for this key
Returns:
APR_SUCCESS if the key was added, APR_EEXIST if the key already exists on the server.

apr_memcache_add_server apr_memcache_t mc,
apr_memcache_server_t server
 

Adds a server to a client object

Parameters:
mc The memcache client object to use
ms Server to add
Remarks:
Adding servers is not thread safe, and should be done once at startup.
Warning:
Changing servers after startup may cause keys to go to different servers.

apr_memcache_create apr_pool_t *  p,
apr_uint16_t  max_servers,
apr_uint32_t  flags,
apr_memcache_t **  mc
 

Creates a new memcached client object

Parameters:
p Pool to use
max_servers maximum number of servers
flags Not currently used
mc location of the new memcache client object

apr_memcache_decr apr_memcache_t mc,
const char *  key,
apr_int32_t  n,
apr_uint32_t *  new_value
 

Decrements a value

Parameters:
mc client to use
key null terminated string containing the key
n number to decrement by
nv new value after decrementing

apr_memcache_delete apr_memcache_t mc,
const char *  key,
apr_uint32_t  timeout
 

Deletes a key from a server

Parameters:
mc client to use
key null terminated string containing the key
timeout time for the delete to stop other clients from adding

apr_memcache_disable_server apr_memcache_t mc,
apr_memcache_server_t ms
 

Disable a Server

Parameters:
mc The memcache client object to use
ms Server to Disable

apr_memcache_enable_server apr_memcache_t mc,
apr_memcache_server_t ms
 

Enables a Server for use again

Parameters:
mc The memcache client object to use
ms Server to Activate

apr_memcache_find_server apr_memcache_t mc,
const char *  host,
apr_port_t  port
 

Finds a Server object based on a hostname/port pair

Parameters:
mc The memcache client object to use
host Hostname of the server
port Port of the server
Returns:
Server with matching Hostname and Port, or NULL if none was found.

apr_memcache_find_server_hash apr_memcache_t mc,
const apr_uint32_t  hash
 

Picks a server based on a hash

Parameters:
mc The memcache client object to use
hash Hashed value of a Key
Returns:
server that controls specified hash
See also:
apr_memcache_hash

apr_memcache_getp apr_memcache_t mc,
apr_pool_t *  p,
const char *  key,
char **  baton,
apr_size_t *  len,
apr_uint32_t *  flags
 

Gets a value from the server, allocating the value out of p

Parameters:
mc client to use
p Pool to use
key null terminated string containing the key
baton location of the allocated value
len length of data at baton
flags any flags set by the client for this key
Returns:

apr_memcache_hash const char *  data,
apr_uint32_t  data_len
 

Creates a crc32 hash used to split keys between servers

Parameters:
data Data to be hashed
data_len Length of the data to use
Returns:
crc32 hash of data
Remarks:
The crc32 hash is not compatible with old memcached clients.

apr_memcache_incr apr_memcache_t mc,
const char *  key,
apr_int32_t  n,
apr_uint32_t *  nv
 

Increments a value

Parameters:
mc client to use
key null terminated string containing the key
n number to increment by
nv new value after incrmenting

apr_memcache_replace apr_memcache_t mc,
const char *  key,
char *  data,
const apr_uint32_t  data_size,
apr_uint32_t  timeout,
apr_uint32_t  flags
 

Replaces value by key on the server

Parameters:
mc client to use
key null terminated string containing the key
baton data to store on the server
len length of data at baton
timeout time for the data to live on the server
flags any flags set by the client for this key
Returns:
APR_SUCCESS if the key was added, APR_EEXIST if the key did not exist on the server.

apr_memcache_server_create apr_pool_t *  p,
const char *  host,
apr_port_t  port,
apr_uint32_t  min,
apr_uint32_t  smax,
apr_uint32_t  max,
apr_uint32_t  ttl,
apr_memcache_server_t **  ns
 

Creates a new Server Object

Parameters:
p Pool to use
host hostname of the server
port port of the server
min minimum number of client sockets to open
smax soft maximum number of client connections to open
max hard maximum number of client connections
ttl time to live in seconds of a client connection
ns location of the new server object
See also:
apr_reslist_create
Remarks:
min, smax, and max are only used when APR_HAS_THREADS

apr_memcache_set apr_memcache_t mc,
const char *  key,
char *  baton,
const apr_uint32_t  data_size,
apr_uint32_t  timeout,
apr_uint32_t  flags
 

Sets a value by key on the server

Parameters:
mc client to use
key null terminated string containing the key
baton data to store on the server
len length of data at baton
timeout time in seconds for the data to live on the server
flags any flags set by the client for this key

apr_memcache_stats apr_memcache_server_t ms,
apr_pool_t *  p,
apr_memcache_stats_t **  stats
 

Query a server for statistics

Parameters:
ms server to query
p Pool to allocate answer from
stats location of the new statistics structure

apr_memcache_version apr_memcache_server_t ms,
apr_pool_t *  p,
char **  baton
 

Query a server's version

Parameters:
ms server to query
p Pool to allocate answer from
baton location to store server version string
len length of the server version string


Generated on Fri Dec 10 15:07:10 2004 for apr_memcache by doxygen 1.3.7