@@ -373,6 +373,8 @@ class DiskLruCache(
373373 entry.readable = true
374374 entry.currentEditor = null
375375 entry.setLengths(parts)
376+ entry.setCreatingDate(parts.filterIndexed { index, _ -> index == 1 }
377+ .firstOrNull()?.toLongOrNull() ? : 0L )
376378 }
377379
378380 secondSpace == - 1 && firstSpace == DIRTY .length && line.startsWith(DIRTY ) -> {
@@ -606,6 +608,7 @@ class DiskLruCache(
606608 writeUtf8(CLEAN ).writeByte(' ' .code)
607609 writeUtf8(entry.key)
608610 entry.writeLengths(this )
611+ entry.writeCreationDate(this )
609612 writeByte(' \n ' .code)
610613 if (success) {
611614 entry.sequenceNumber = nextSequenceNumber++
@@ -1125,6 +1128,10 @@ class DiskLruCache(
11251128 }
11261129 }
11271130
1131+ fun setCreatingDate (creatingDateInMilliseconds : Long ) {
1132+ this .creatingDateInMilliseconds = creatingDateInMilliseconds
1133+ }
1134+
11281135 /* * Append space-prefixed lengths to [writer]. */
11291136 @Throws(IOException ::class )
11301137 internal fun writeLengths (writer : BufferedSink ) {
@@ -1133,6 +1140,12 @@ class DiskLruCache(
11331140 }
11341141 }
11351142
1143+ /* * Append space-prefixed creation date in milliseconds to [writer]. */
1144+ @Throws(IOException ::class )
1145+ internal fun writeCreationDate (writer : BufferedSink ) {
1146+ writer.writeByte(' ' .code).writeDecimalLong(creatingDateInMilliseconds)
1147+ }
1148+
11361149 @Throws(IOException ::class )
11371150 private fun invalidLengths (strings : List <String >): Nothing =
11381151 throw IOException (" unexpected journal line: $strings " )
0 commit comments