void
vmod_set(struct sess *sp, struct vmod_priv *priv, const char *key, const char *value, int expiration, int flags)
{
	memcached_return rc;
	memcached_st *mc = get_memcached(priv->priv);
	if (!mc) return;

	rc = memcached_set(mc, key, strlen(key), value, strlen(value), expiration, flags);
}
int
vmod_decr(struct sess *sp, struct vmod_priv *priv, const char *key, int offset)
{
	uint64_t value = 0;
	memcached_return rc;
	memcached_st *mc = get_memcached(priv->priv);
	if (!mc) return 0;

	rc = memcached_decrement(mc, key, strlen(key), offset, &value);

	return (int)value;
}
void
vmod_behavior_set(struct sess *sp, struct vmod_priv *priv, const char *flag, const char *data)
{
	memcached_return rc;
	memcached_st *mc = get_memcached(priv->priv);
	if (!mc) return;

    int flag_i = str_to_mc_enum(flag);
    int data_i = str_to_mc_enum(data);

	rc = memcached_behavior_set(mc, flag_i, data_i);
}
const char *
vmod_get(struct sess *sp, struct vmod_priv *priv, const char *key)
{
	size_t len;
	uint32_t flags;
	memcached_return rc;
	memcached_st *mc = get_memcached(priv->priv);
	if (!mc) return NULL;

	char *value = memcached_get(mc, key, strlen(key), &len, &flags, &rc);
	if (!value) return NULL;

	char *ws_buf = WS_Dup(sp->ws, value);
	free(value);

	return ws_buf;
}