!12 DiskLruCache resolved some issues

Merge pull request !12 from 周黎生/master
This commit is contained in:
openharmony_ci 2022-05-13 07:04:19 +00:00 committed by Gitee
commit 7f51a5bf78
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 3 additions and 2 deletions

View File

@ -162,6 +162,7 @@ export class DiskLruCache {
*/
setMaxSize(max: number) {
this.maxSize = max
this.trimToSize()
}
/**
@ -238,7 +239,7 @@ export class DiskLruCache {
if (this.fileUtils.exist(path)) {
var ab: ArrayBuffer = this.fileUtils.readFilePic(path)
this.putCacheMap(key, ab.byteLength)
this.fileUtils.writeData(path, 'read ' + key + '\n')
this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n')
return ab
} else {
return null;
@ -260,7 +261,7 @@ export class DiskLruCache {
}
var path = this.dirPath + key;
if (this.fileUtils.exist(path)) {
this.fileUtils.writeData(path, 'read ' + key + '\n')
this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n')
return path
} else {
return null