forked from floraachy/ImageKnife
!12 DiskLruCache resolved some issues
Merge pull request !12 from 周黎生/master
This commit is contained in:
commit
7f51a5bf78
|
@ -162,6 +162,7 @@ export class DiskLruCache {
|
||||||
*/
|
*/
|
||||||
setMaxSize(max: number) {
|
setMaxSize(max: number) {
|
||||||
this.maxSize = max
|
this.maxSize = max
|
||||||
|
this.trimToSize()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -238,7 +239,7 @@ export class DiskLruCache {
|
||||||
if (this.fileUtils.exist(path)) {
|
if (this.fileUtils.exist(path)) {
|
||||||
var ab: ArrayBuffer = this.fileUtils.readFilePic(path)
|
var ab: ArrayBuffer = this.fileUtils.readFilePic(path)
|
||||||
this.putCacheMap(key, ab.byteLength)
|
this.putCacheMap(key, ab.byteLength)
|
||||||
this.fileUtils.writeData(path, 'read ' + key + '\n')
|
this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n')
|
||||||
return ab
|
return ab
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -260,7 +261,7 @@ export class DiskLruCache {
|
||||||
}
|
}
|
||||||
var path = this.dirPath + key;
|
var path = this.dirPath + key;
|
||||||
if (this.fileUtils.exist(path)) {
|
if (this.fileUtils.exist(path)) {
|
||||||
this.fileUtils.writeData(path, 'read ' + key + '\n')
|
this.fileUtils.writeData(this.journalPath, 'read ' + key + '\n')
|
||||||
return path
|
return path
|
||||||
} else {
|
} else {
|
||||||
return null
|
return null
|
||||||
|
|
Loading…
Reference in New Issue