move select database command to open context function
make sync slower when loader process is running, and freeze entries to sync when it has finished
always close the file descriptor
using filename as part of database key
check in database if the file is present before try to read the cache key