You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
FONGMITV/quickjs/src/main/java/com/fongmi/quickjs/method/Local.java

33 lines
740 B

package com.fongmi.quickjs.method;
import android.text.TextUtils;
import androidx.annotation.Keep;
import com.github.catvod.utils.Prefers;
import com.whl.quickjs.wrapper.JSMethod;
public class Local {
private String getKey(String rule, String key) {
return "cache_" + (TextUtils.isEmpty(rule) ? "" : rule + "_") + key;
}
@Keep
@JSMethod
public String get(String rule, String key) {
return Prefers.getString(getKey(rule, key));
}
@Keep
@JSMethod
public void set(String rule, String key, String value) {
Prefers.put(getKey(rule, key), value);
}
@Keep
@JSMethod
public void delete(String rule, String key) {
Prefers.remove(getKey(rule, key));
}
}