File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,8 @@ public function __construct($base_url, $http)
1010
1111 /**
1212 * 删除指定键值
13- * @param string $key
13+ *
14+ * @param string $key 键
1415 *
1516 * @return bool 是否删除成功
1617 */
@@ -21,8 +22,38 @@ public function delete($key)
2122 return $ resp == 'true ' ;
2223 }
2324
25+ /**
26+ * 设置键值
27+ *
28+ * @param string $key 键
29+ * @param string $value 值
30+ *
31+ * @return bool 是否设置成功
32+ */
33+ public function set ($ key , $ value )
34+ {
35+ $ url = $ this ->name . '/ ' . $ key ;
36+ $ resp = $ this ->http ->request ($ this ->base_url . $ url , $ value , 'PUT ' );
37+ return $ resp == 'true ' ;
38+ }
39+
40+ /**
41+ * 获取指定键的值
42+ *
43+ * @param string $key 键
44+ *
45+ * @return string 值
46+ */
47+ public function get ($ key )
48+ {
49+ $ url = $ this ->name . '/ ' . $ key ;
50+ $ resp = $ this ->http ->request ($ this ->base_url . $ url );
51+ return $ this ->response ($ resp );
52+ }
53+
2454 /**
2555 * 返回指定键下的键名列表,如果指定键下还有子级的话
56+ *
2657 * @param string $key
2758 *
2859 * @return mixed|string
You can’t perform that action at this time.
0 commit comments