构造函数
copy() -> RedisValue
move_to(RedisValue) -> None
move_from(RedisValue) -> None
set_nil() -> None
set_int(int) -> None
set_array(uint newsize) -> None
set_string(str/bytes) -> None
set_status(str/bytes) -> None
set_error(str/bytes) -> None
is_ok() -> bool
is_error() -> bool
is_nil() -> bool
is_int() -> bool
is_array() -> bool
is_string() -> bool
string_value() -> bytes
int_value() -> int
arr_size() -> int
arr_clear() -> None
arr_resize(uint newsize) -> None
clear() -> None
set_nil
debug_string() -> bytes
arr_at(uint pos) -> wf.RedisValue
arr_at_ref(uint pos) -> wf.RedisValue
arr_at_object(uint pos) -> object
as_object() -> object
start(port)
RedisTask使用较为简单,直接参考tutorials即可。
# RedisValue
import pywf as wf
def construct():
v1 = wf.RedisValue()
print(v1.as_object()) # None
def set_check():
v1 = wf.RedisValue()
v2 = wf.RedisValue()
v1.set_int(1024)
v2.set_status(b'status')
print(v1.is_int(), v1.int_value()) # True 1024
print(v2.is_ok(), v2.is_string(), v2.string_value()) # True True b'status'
def array():
v1 = wf.RedisValue()
v1.set_array(3)
v1[0].set_string('string')
v11_ref = v1.arr_at_ref(1)
v11_ref.set_array(2)
v11_ref[0].set_int(1)
v11_ref[1].set_string(b'value')
v1[2] = v1[0] # v1[2] is a copy of v1[0]
v1[0].set_nil()
print(v1.as_object()) # [None, [1, b'value'], b'string']
v2 = wf.RedisValue()
v3 = wf.RedisValue()
v3.set_string('string')
v2.set_array(2)
v3.move_to(v2[0])
v21 = v2.arr_at(1) # arr_at returns a copy
v21.set_error('error') # So v2[1] not changed
print(v2.as_object()) # [b'string', None]
if __name__ == "__main__":
construct()
set_check()
array()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。