rewrite of light table caching

features:
- fixed mip map levels for usual screen resolutions, naturally extends to 4k/8k screens without invalidating the cache
- simple implementation with debugging facilities for read/write locks
- thread safe api
- thumbnails are written to disk upon eviction, not forgotten (only way to delete them from within dt is removing the image from collection)
- offline create all thumbs using 'darktable-cli --generate-cache --core --library /your/library.db'
- disk backend is simple jpg files, you can actually look at them and just delete them safely, no db index required.
- no more [bundled | dependency on] libsquish,

possible drawbacks:
- not sure this will work on 32-bits (calls alloc/free a lot, will run out of virtual address space)
- will use unbounded disk space (like 1% of the storage of your raw files, for 20MB raws, if you need /all/ thumbnails of all sizes). possible strategies to improve that in the future are: write only mip0-2/user configured bound, stop writing if disk is filling up.
- cached jpg files are many and small, might interfere with some file systems with large block sizes.

what about the == 0 case? i thought sqlite indices were 1-based. anyways this is for the case where the cache doesn't return an image because it is full and all entries are locked/can't be evicted. i don't think this should happen any more (the new cache will temporarily go over memory budget to avoid this.. of course crashing if the caller requests an unbounded amount of data and never releases the locks).