mirror of
				https://github.com/TeaOSLab/EdgeAdmin.git
				synced 2025-11-04 05:00:25 +08:00 
			
		
		
		
	缓存策略类型从“内存缓存”切换到“文件缓存“时增加默认设置
This commit is contained in:
		@@ -12,7 +12,7 @@
 | 
			
		||||
			<tr>
 | 
			
		||||
				<td class="color-border">缓存类型 *</td>
 | 
			
		||||
				<td>
 | 
			
		||||
					<select class="ui dropdown auto-width" name="type" v-model="policyType">
 | 
			
		||||
					<select class="ui dropdown auto-width" name="type" v-model="policyType" @change="changePolicyType">
 | 
			
		||||
						<option v-for="type in types" :value="type.type">{{type.name}}</option>
 | 
			
		||||
					</select>
 | 
			
		||||
				</td>
 | 
			
		||||
 
 | 
			
		||||
@@ -7,4 +7,20 @@ Tea.context(function () {
 | 
			
		||||
	if (this.cachePolicy.type == "file" && this.cachePolicy.options.openFileCache != null && this.cachePolicy.options.openFileCache.isOn && this.cachePolicy.options.openFileCache.max > 0) {
 | 
			
		||||
		this.fileOpenFileCacheMax = this.cachePolicy.options.openFileCache.max
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	this.changePolicyType = function () {
 | 
			
		||||
		if (this.policyType == "file") {
 | 
			
		||||
			let options = this.cachePolicy.options
 | 
			
		||||
			if (options != null && typeof options == "object" && typeof options["dir"] === "undefined") {
 | 
			
		||||
				options["enableMMAP"] = true
 | 
			
		||||
				options["dir"] = "/opt/cache"
 | 
			
		||||
				options["memoryPolicy"] = {
 | 
			
		||||
					capacity: {
 | 
			
		||||
						unit: "gb",
 | 
			
		||||
						count: 2
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
})
 | 
			
		||||
		Reference in New Issue
	
	Block a user