mirror of
https://github.com/venera-app/venera.git
synced 2025-09-27 07:47:24 +00:00
improve cache
This commit is contained in:
@@ -41,6 +41,7 @@ class Log {
|
|||||||
|
|
||||||
static void addLog(LogLevel level, String title, String content) {
|
static void addLog(LogLevel level, String title, String content) {
|
||||||
if (!ignoreLimitation && content.length > maxLogLength) {
|
if (!ignoreLimitation && content.length > maxLogLength) {
|
||||||
|
File("D://debug.txt").writeAsString(content);
|
||||||
content = "${content.substring(0, maxLogLength)}...";
|
content = "${content.substring(0, maxLogLength)}...";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -160,6 +160,9 @@ class NetworkCacheManager implements Interceptor {
|
|||||||
if (response.requestOptions.method != "GET") {
|
if (response.requestOptions.method != "GET") {
|
||||||
return handler.next(response);
|
return handler.next(response);
|
||||||
}
|
}
|
||||||
|
if(response.statusCode != null && response.statusCode! >= 400){
|
||||||
|
return handler.next(response);
|
||||||
|
}
|
||||||
var size = _calculateSize(response.data);
|
var size = _calculateSize(response.data);
|
||||||
if(size != null && size < 1024 * 1024 && size > 0) {
|
if(size != null && size < 1024 * 1024 && size > 0) {
|
||||||
var cache = NetworkCache(
|
var cache = NetworkCache(
|
||||||
@@ -190,6 +193,9 @@ class NetworkCacheManager implements Interceptor {
|
|||||||
if(data.trim().isEmpty){
|
if(data.trim().isEmpty){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(data.length < 512 && data.contains("IP address")){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
return data.length * 4;
|
return data.length * 4;
|
||||||
}
|
}
|
||||||
if(data is Map) {
|
if(data is Map) {
|
||||||
|
Reference in New Issue
Block a user