frostyfan109 / tranql

A Translator Query Language
https://researchsoftwareinstitute.github.io/data-translator/apps/tranql
MIT License
0 stars 1 forks source link

Cached queries are not overridden if a cached query is run while the cache is disabled #84

Closed frostyfan109 closed 5 years ago

frostyfan109 commented 5 years ago

According to Dexie's [documentation](https://dexie.org/docs/Table/Table.put()#remarks), Table::put overrides any entries that have the same primary key, so this likely has something to do with it not caching it for some reason.

frostyfan109 commented 5 years ago

Nevermind, this doesn't seem to be happening?

frostyfan109 commented 5 years ago

This is actually happening. It loads the knowledge graph from the response but does not cache it successfully.

Edit: I misunderstood Dexie's schema structure. The ampersand means unique index, not primary key. We're trying to store an object that has a duplicate unique index, so it doesn't work. I think the correct method if we want to update an object is Table::update.

frostyfan109 commented 5 years ago

Fixed. Now Cache::write looks for any unique keys in the object that is being cached, checks the table to see if any other objects have the same unique key value, and if so, updates said object.