Compare commits
2 Commits
f810fba0fe
...
bf2f6016aa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf2f6016aa | ||
|
|
1e8360b15a |
@@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
import 'dart:math';
|
||||
@@ -429,17 +428,23 @@ class AniyomiBridge {
|
||||
|
||||
String _generateCacheKey(JniIsolateMessageType messageType, Map<String, dynamic> args) {
|
||||
// Create a stable string representation of the args
|
||||
final argsString = jsonEncode(args);
|
||||
// final argsString = jsonEncode(args);
|
||||
final argsString = args.entries
|
||||
.map((entry) => "${entry.key}:${_getStableHashCode(entry.value)}")
|
||||
.join(":").hashCode;
|
||||
return "${messageType.name}_$argsString";
|
||||
}
|
||||
|
||||
|
||||
|
||||
// bool _isCacheable(JniIsolateMessageType messageType) {
|
||||
// if (config.cacheDisabledMessageType.contains(messageType)){
|
||||
// _logger.w("Endpoint $messageType is disabled for caching");
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// }
|
||||
int _getStableHashCode(dynamic value) {
|
||||
if (value is JSEpisode) {
|
||||
return value.getUrl().toDartString().hashCode;
|
||||
}else if (value is JSAnime) {
|
||||
return value.getUrl().toDartString().hashCode;
|
||||
} else if (value is JSManga) {
|
||||
return value.getUrl().toDartString().hashCode;
|
||||
} else if (value is JSChapter) {
|
||||
return value.getUrl().toDartString().hashCode;
|
||||
}
|
||||
return value.hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user