0

I am using a DiskLruCache to store around 70k files. These files are really small, half of them are not even 13 bytes each. However each file size is at least 4kb in disk because I assume that's the minimum block size. Therefore when I set a maxSize for the cache of 256MB the cache actually grows above the 450MB in disk. I modified the code in DiskLruCache so it takes in consideration that files are stored in 4kb blocks.. however, my question is, can I rely that every Android device will always divide its sdcard in 4kb blocks? Could it be that another device has a bigger or smaller block size?

Héctor Júdez Sapena
  • 5,329
  • 3
  • 23
  • 31
  • This does not seem like something you can rely on, as in many cases the "sdcard" is actually emulated. It sounds like your ultimate need might be better handled by a database engine rather than with discrete files managed yourself. – Chris Stratton Nov 27 '15 at 00:36

1 Answers1

0

I used StatFs(directory.getAbsolutePath()).getBlockSize()

Héctor Júdez Sapena
  • 5,329
  • 3
  • 23
  • 31