Closed elliottsj closed 10 years ago
Haven't figured out the problem yet, but 20 ^ 2
is 22, not 400. ^
is exclusive OR. That shouldn't be causing your problems, though.
Thanks; it looks like the cache size was the issue. 20 * 2^20 == 60
, while it should have been 20 * Math.pow(2, 20) == 20971520
. I've updated the gist with the corrected cache size.
See https://gist.github.com/elliottsj/8198330
The JUnit test runs fine and creates the file
DiskLruCacheTest/test-store-array-list.0
, but when the same code is put into themain
method, the program hangs for a while and does not create the fileDiskLruCache/test-store-array-list.0
.I'm using JDK 1.7.0_40 in the gist, but I'm having the same issue in my Android app (API 19) where
ArrayList
s are not being written to the cache.