mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-04 13:10:26 +08:00
实现缓存策略的部分功能
This commit is contained in:
63
web/views/@default/servers/components/cache/test.js
vendored
Normal file
63
web/views/@default/servers/components/cache/test.js
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
Tea.context(function () {
|
||||
if (this.clusters.length > 0) {
|
||||
this.clusterId = this.clusters[0].id
|
||||
} else {
|
||||
this.clusterId = 0
|
||||
}
|
||||
|
||||
this.isRequestingWrite = false
|
||||
this.writeOk = false
|
||||
this.writeMessage = ""
|
||||
this.writeIsAllOk = false
|
||||
this.writeResults = []
|
||||
|
||||
this.beforeWrite = function () {
|
||||
this.isRequestingWrite = true
|
||||
this.writeOk = false
|
||||
this.writeMessage = ""
|
||||
this.writeResult = {}
|
||||
}
|
||||
|
||||
this.failWrite = function (resp) {
|
||||
this.writeOk = false
|
||||
this.writeMessage = resp.message
|
||||
}
|
||||
|
||||
this.successWrite = function (resp) {
|
||||
this.writeOk = true
|
||||
this.writeIsAllOk = resp.data.isAllOk
|
||||
this.writeResults = resp.data.results
|
||||
}
|
||||
|
||||
this.doneWrite = function () {
|
||||
this.isRequestingWrite = false
|
||||
}
|
||||
|
||||
this.isRequestingRead = false
|
||||
this.readOk = false
|
||||
this.readMessage = ""
|
||||
this.readIsAllOk = false
|
||||
this.readResults = []
|
||||
|
||||
this.beforeRead = function () {
|
||||
this.isRequestingRead = true
|
||||
this.readOk = false
|
||||
this.readMessage = ""
|
||||
this.readResult = {}
|
||||
}
|
||||
|
||||
this.failRead = function (resp) {
|
||||
this.readOk = false
|
||||
this.readMessage = resp.message
|
||||
};
|
||||
|
||||
this.successRead = function (resp) {
|
||||
this.readOk = true;
|
||||
this.readIsAllOk = resp.data.isAllOk
|
||||
this.readResults = resp.data.results
|
||||
}
|
||||
|
||||
this.doneRead = function () {
|
||||
this.isRequestingRead = false
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user