The album disk cache contains three files: imgcache.0, imgcache.1, and imgcache. idx. The imgcache. idx index file and the other two data files (storing thumbnail content ).
Index file format:
| Magic |
Max_entries |
Max_bytes |
Active_region |
Active_entries |
Active_bytes |
Version |
Checksum |
Thumb_key |
Thumb_offset |
Thumb_key |
Thumb_offset |
... |
The green part is the index file header, and each byte is 4 bytes, a total of 32 bytes. the yellow part indicates that each thumbnail can be at the starting position of the data file, and the thumb_key occupies 8 bytes, thumb_offset occupies three bytes. Each representation of a thumbnail requires 12 bytes.
Data File Format:
| Magic |
Key |
Checksum |
Offset |
Length |
Data (VAR-LEN) |
Key |
Checksum |
Offset |
Length |
Data (VAR-LEN) |
... |
The gray part is the file header, which only occupies four bytes. The blue area is the Blob header of the data, the key occupies eight bytes, and the remaining four bytes, totaling 22 bytes. The red area is the data field, variable Length (BLOB length) indicates the specific thumbnail data.
Blobcache loading process:
Thumbnail insertion process:
Thumbnail Query Process:
Location: https://github.com/zhangcheng0308/GalleryDiskCache
Album disk cache Analysis