Hello ! I am using cachios, which speeds up a lot my site by caching http request with different ttl for each request.
But it seems that running Nuxt.js, there is one cachios instance for the server and one for the browser, so when a page has been cached by server, browser can not get it; and vice versa.
Is it possible with Nuxt.js that browser and server feed and get data from the same cachios instance ? I have no idea how to to this, maybe with store and nuxtServerInit action ?
i want to access then this cache object instance from this file : https://github.com/nyl-auster/yineo-nuxt-wordpress/blob/master/services/wpContentApi.js
But how am i supposed to access the store object from this service file ?
(code below is my index.hs from store and does not work at all , saying : "TypeError: Converting circular structure to JSON")
import cachios from 'cachios'
import Vuex from 'vuex'
/**
* This our global state for our app.
*/
const createStore = () => new Vuex.Store({
state: {
menuMobileIsOpened: false,
cachiosInstance: null
},
mutations: {
setMenuMobileIsOpened (state, value) {
state.menuMobileIsOpened = value
},
setCachiosInstance (state, value) {
state.cachiosInstance = value
}
},
actions: {
nuxtServerInit ({ commit }) {
commit('setCachiosInstance', cachios)
}
}
})
export default createStore
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c1124">#c1124</a>)</em></sub></div>