phpredis_program
PhpRedis Program and Struct
Redis Developer Course | Redis Technical Support | Redis Enterprise Server |
---|
PHP & Zend
PHP version 7.2.34 -> /usr/include/php
Zend version 3.2.0 -> /usr/include/php/Zend
PhpRedis 5.3.3
목차
- redis_string_response() -> library.c
- redis_sock_read() -> library.c
- INTERNAL_FUNCTION_PARAMETERS -> zend.h
- ZVAL -> zend_types.h
- RETVAL_BOOL -> zend_API.h
- PHP_METHOD
- struct RedisSock -> PhpRedis common.h
- struct RedisArray -> PhpRedis redis_array.h
- struct redisClusterNode -> PhpRedis cluster_library.h
redis_string_response()
redis_string_response()는 phpredis -> library.c에 있고, get, lpop, rpop, spop, hget에서 사용합니다.
PHP_REDIS_API void redis_string_response(
INTERNAL_FUNCTION_PARAMETERS,
RedisSock *redis_sock, zval *z_tab, void *ctx) {
char *response;
int response_len;
if ((response = redis_sock_read(redis_sock, &response_len)) == NULL) {
if ( IS_ATOMIC(redis_sock)) {
RETURN_FALSE;
}
add_next_index_bool(z_tab, 0);
return;
}
if (IS_ATOMIC(redis_sock)) {
if (!redis_unpack(redis_sock, response, response_len, return_value)) {
RETVAL_STRINGL(response, response_len);
}
} else {
zval z_unpacked;
if (redis_unpack(redis_sock, response, response_len, &z_unpacked)) {
add_next_index_zval(z_tab, &z_unpacked);
} else {
add_next_index_stringl(z_tab, response, response_len);
}
}
efree(response);
}
redis_string_response( INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, NULL);
RedisSock *redis_sock, zval *z_tab, void *ctx) {
char *response;
int response_len;
if ((response = redis_sock_read(redis_sock, &response_len)) == NULL) {
if ( IS_ATOMIC(redis_sock)) {
RETURN_FALSE;
}
add_next_index_bool(z_tab, 0);
return;
}
if (IS_ATOMIC(redis_sock)) {
if (!redis_unpack(redis_sock, response, response_len, return_value)) {
RETVAL_STRINGL(response, response_len);
}
} else {
zval z_unpacked;
if (redis_unpack(redis_sock, response, response_len, &z_unpacked)) {
add_next_index_zval(z_tab, &z_unpacked);
} else {
add_next_index_stringl(z_tab, response, response_len);
}
}
efree(response);
}
redis_string_response( INTERNAL_FUNCTION_PARAM_PASSTHRU, redis_sock, NULL, NULL);
redis_sock_read()
레디스 응답(reply) 코드에 따른 처리를 볼 수 있다.
INTERNAL_FUNCTION_PARAMETERS
zend.h
ZVAL
zend_types.h
- WORDS_BIGENDIAN
- regular data types
- Z_TYPE_INFO
zend_API.h
- 1) 배열 인덱스를 지정 specific
- 2) 배열 다음 next 인덱스 자동 지정
- 3) 배열 연관 associative 인덱스 지정
PHP_METHOD -> zend_API.h
- php.h
- zend_API.h
- zend_complie.h
PhpRedis
PhpRedis 5.3.3
common.h
- struct RedisSock
- Transaction modes
- REDIS_PROCESS_CMD
- REDIS_PROCESS_KW_CMD
- REDIS_PROCESS_REQUEST
- REDIS_PROCESS_RESPONSE
redis_array.h
- struct RedisArray
cluster_library.h
- struct redisClusterNode
- struct redisCluster
<< Enterprise | Program | Table >> |
---|