import request from "@/utils/httpRequest";
import { SYS_PATH as prefix } from "../AppPath";

export default {
	treeData: function (params) {
		return request({
			url: prefix + "/redis/treeData",
			method: "get",
			params: params,
		});
	},

	flushdb: function () {
		return request({
			url: prefix + "/redis/flushdb",
			method: "delete",
		});
	},

	delPattern: function (pattern) {
		return request({
			url: prefix + "/redis/delPattern",
			method: "delete",
			params: { pattern: pattern },
		});
	},

	delKey: function (key) {
		return request({
			url: prefix + "/redis/delKey",
			method: "delete",
			params: { key: key },
		});
	},

	setValue: function (key, value) {
		return request({
			url: prefix + "/redis/setValue",
			method: "put",
			params: { key: key, value: value },
		});
	},

	queryByKey: function (key) {
		return request({
			url: prefix + "/redis/queryByKey",
			method: "get",
			params: { key: key },
		});
	},
};
