fixed bugs with SqliteKeyValueStore + added a caching layer