Fix for the cache inconsistency

Untested. This change should allow the cache to be updated with the most current inserted value.

The library is still unfit for production use because of various timing/data corruption issues due to missing synchronization and lingering file handles.