flexmonster-mongo-connector getDataFromCache issue

Re-Open
Rainer Wittmann asked on November 12, 2021

We have the need to support multiple databases and have expanded the pivot-mongo example as a POC.

Overall the result looks good, however, there's an issue with the getDataFromCache method. As you can see it only gets the query passed in. However caching, must be accomplished based on a hash value of db/index and query values otherwise caching will return the wrong data.

    _getData(apiRequest) {
        return __awaiter(this, void 0, void 0, function* () {
            let query = JSON.stringify(apiRequest.requestArgument.clientQuery);
            let data
            // let data = this.getDataFromCache(query);
            LoggingManager_1.LoggingManager.log(`Client query: ${JSON.stringify(apiRequest.requestArgument.clientQuery)}`);
            if (data === undefined) {
                data = yield apiRequest.getData(this._queryBuilder, this._queryExecutor);
                this.setDataToCache(query, data);
                if (ConfigManager_1.ConfigManager.getInstance().currentConfig.cacheEnabled) {
                    LoggingManager_1.LoggingManager.log(`Putting ${apiRequest.loggingTemplate} data to cache`);
                    LoggingManager_1.LoggingManager.log(this.getCacheMemoryStatus());
                }
            }
            else {
                LoggingManager_1.LoggingManager.log(`Getting ${apiRequest.loggingTemplate} data from cache`);
            }
            return data;
        });
    }

2 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster November 22, 2021

Hello, Rainer,
 
Thank you for contacting us.
 
Your suggestion about the getDataFromCache method sounds reasonable. We have added an appropriate task to our backlog. I'm afraid that there is no clear ETA for this. Our team will notify you in case something is changed on this point. 
However, if it is important for your case, feel free to check a project with the MongoDB Connector on our GitHub and change the source code: https://github.com/flexmonster/flexmonster-mongodb-connector.
 
Please let us know if any questions arise.
 
Kind regards,
Nadia

Public
Rainer Wittmann November 26, 2021

Ok, that will work. 
Thanks,
Rainer

Please login or Register to Submit Answer