DiskLruCache class

Properties

appVersion String
版本
final
cacheDirectory Directory
存储缓存的文件路径
final
hashCode int
The hash code for this object.
no setterinherited
isClosed Future<bool>
检查是否关闭缓存
no setter
journalFile File
操作数据的记录文件
latefinal
journalFileBackup File
备份文件
latefinal
journalFileTmp File
重新构建的记录临时文件
latefinal
maxSize Future<int>
返回此缓存应用于存储其数据的最大字节数
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
size Future<int>
容量的大小
no setter
valueCount int
ValuesCount是Key所对应的文件数,我们通常选择一一对应的简单关系,这样比较方便控制,当然我们也可以一对多的关系,通常写入1,表示一一对应的关系。
final

Methods

close() Future<void>
关闭此缓存。存储的值将保留在文件系统上。
delete() Future<void>
关闭缓存并删除其所有存储值。这将删除缓存目录中的所有文件,包括不是由创建的文件缓存。
edit(String key, {int sequenceNumber = ANY_SEQUENCE_NUMBER}) Future<Editor?>
返回名为key的条目的编辑器,如果另一个条目为空,则返回null
flush() Future<void>
刷新文件系统缓冲区
get(String key) Future<Snapshot?>
返回名为key的项的快照,如果不返回,则返回null exist当前不可读。如果返回值,则将其移动到队列的头
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove(String key) Future<bool>
如果密钥存在并且可以删除,则删除该项。条目无法删除正在编辑的活动项 如果条目被删除,则返回true。
setMaxSize(int maxSize) Future<void>
更改缓存可以存储的最大字节数
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

open(Directory directory, {String version = "1.0.0", int valueCount = 1, int maxSize = 20 * 1024 * 1024}) Future<DiskLruCache>
检查是否存在缓存目录,没有就创建

Constants

ANY_SEQUENCE_NUMBER → const int
CLEAN → const String
DIRTY → const String
JOURNAL_FILE → const String
操作的记录文件名
JOURNAL_FILE_BACKUP → const String
备份文件
JOURNAL_FILE_TEMP → const String
临时文件
MAGIC → const String
标识
READ → const String
记录的操作行为符
REMOVE → const String
STRING_KEY_PATTERN → const String
正则匹配
VERSION_1 → const String
版本