Save last query & timestamp by default
See original GitHub issueSteps to reproduce
- dispatch a
find
in one page of your app. - Navigate to another that effectively needs the same data.
Expected behavior
We should have a way to tell how old the cache is and what query populated it. That would allow us to say, not run the query again if it was ran less than a minute ago.
Actual behavior
The cache has no origin information, no information about whether the connection dropped since it was populated and no information about the query that populated it. Therefore, we have no guarantees about the data and are thus forced to implement our optimization or fire the potentially non-trivial query again.
Working with feathers-vuex is currently quite wordy… we should look for ways to cut down lines for the typical app.
Proposed Solution
Lets add a property to the vuex state with
last: {
createdAt: 14245678921
query: 'find'
params: '{}'
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Saving last SQL query state in PHP - Stack Overflow
In the query, filter out all entries with a last_updated that is before the last time the query was executed (or possibly the...
Read more >11.2.5 Automatic Initialization and Updating for TIMESTAMP ...
To specify automatic properties, use the DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP clauses in column definitions. The order of the clauses does ...
Read more >MySQL Best approach for recording last update timestamp for ...
MySQL Best approach for recording last update timestamp for every column and every row · 1. Create an additional timestamp column for each...
Read more >How to Update Current Timestamp in MySQL? - GeeksforGeeks
In MySQL, there is a facility to keep the default current timestamp ... Query: ALTER TABLE employee MODIFY COLUMN empLoginTime TIMESTAMP ...
Read more >Timestamp functions in Google Standard SQL | Cloud Spanner
Google Standard SQL for Spanner supports the following timestamp functions. ... For example, the following query will select the function in the now...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
fun real world edge case:
Google play music will only get the playlist list once and pull from cache every time you go to the playlist list page. It will reactively add to the list, but if your laptop is asleep, you’ll end up with missing playlists even though you’ve “browsed” back and forth between pages inside Google Play Music.
AllGet would solve this, but it would be expensive for Google. AllGet([id, maxAge]) would fix the problem without hitting the server every time.
Off topic, I would really love built in eager updates support that doesn’t require a local proxy copy to support vuex strict mode. Something like
patch([id, params, vuexParams])
where I can say{eager: true, rollback: false}
.I also like the idea of a
maxAge
-based cache. As a baby step towards this, I’ve added acreatedAt
timestamp to the pagination data infeathers-vuex@1.6.2
.