Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5d1745b

Browse files
For local file url, ignore disk cache
1 parent42afd0c commit5d1745b

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

‎BBWebImage/BBWebImage/Core/BBDiskStorage.swift‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class BBDiskStorage {
5757
returnnil
5858
}
5959
letsql="PRAGMA journal_mode = WAL; PRAGMA synchronous = NORMAL; CREATE TABLE IF NOT EXISTS Storage_item (key text PRIMARY KEY, filename text, data blob, size integer, last_access_time real); CREATE INDEX IF NOT EXISTS last_access_time_index ON Storage_item(last_access_time);"
60-
ifsqlite3_exec(database, sql,nil,nil,nil)!= SQLITE_OK{
60+
ifsqlite3_exec(database, sql.bb_utf8,nil,nil,nil)!= SQLITE_OK{
6161
print("Fail to create BBCache sqlite Storage_item table")
6262
try?FileManager.default.removeItem(atPath: path)
6363
returnnil
@@ -97,7 +97,7 @@ public class BBDiskStorage {
9797
if data!=nil{
9898
// Update last access time
9999
letsql="UPDATE Storage_item SET last_access_time =\(CACurrentMediaTime()) WHERE key = '\(key)';"
100-
ifsqlite3_exec(database, sql,nil,nil,nil)!= SQLITE_OK{
100+
ifsqlite3_exec(database, sql.bb_utf8,nil,nil,nil)!= SQLITE_OK{
101101
print("Fail to set last_access_time for key\(key)")
102102
}
103103
}
@@ -180,7 +180,7 @@ public class BBDiskStorage {
180180
publicfunc clear(){
181181
ioLock.wait()
182182
letsql="DELETE FROM Storage_item;"
183-
ifsqlite3_exec(database, sql,nil,nil,nil)!= SQLITE_OK{
183+
ifsqlite3_exec(database, sql.bb_utf8,nil,nil,nil)!= SQLITE_OK{
184184
print("Fail to delete data")
185185
}
186186
iflet enumerator=FileManager.default.enumerator(atPath: baseDataPath){
@@ -266,7 +266,7 @@ public class BBDiskStorage {
266266
}
267267
// Delete from database
268268
letsql="DELETE FROM Storage_item WHERE key = '\(key)';"
269-
ifsqlite3_exec(database, sql,nil,nil,nil)!= SQLITE_OK{
269+
ifsqlite3_exec(database, sql.bb_utf8,nil,nil,nil)!= SQLITE_OK{
270270
print("Fail to remove data for key\(key)")
271271
}
272272
}
@@ -336,7 +336,7 @@ public class BBDiskStorage {
336336

337337
privatefunc removeDataEarlierThan(_ time:TimeInterval){
338338
letsql="DELETE FROM Storage_item WHERE last_access_time <\(time);"
339-
ifsqlite3_exec(database, sql,nil,nil,nil)!= SQLITE_OK{
339+
ifsqlite3_exec(database, sql.bb_utf8,nil,nil,nil)!= SQLITE_OK{
340340
print("Fail to remove data earlier than\(time)")
341341
}
342342
}

‎BBWebImage/BBWebImage/Core/BBWebImageManager.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,9 @@ public class BBWebImageManager {
286286
}
287287
if finished{return task}
288288

289-
if options.contains(.ignoreDiskCache){
289+
if options.contains(.ignoreDiskCache)|| resource.downloadUrl.isFileURL{
290290
downloadImage(with: resource,
291-
options: options,
291+
options: options.union(.ignoreDiskCache),
292292
task: task,
293293
editor: editor,
294294
progress: progress,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp